Commit cd527bb3 authored by Damien George's avatar Damien George

lib/libm: Move Thumb-specific sqrtf function to separate file.

This allows it to be used only when the hardware supports VFP
instructions, preventing compile errors.
parent 828df54b
...@@ -86,19 +86,6 @@ double __aeabi_dmul(double x , double y) { ...@@ -86,19 +86,6 @@ double __aeabi_dmul(double x , double y) {
#endif // defined(__thumb__) #endif // defined(__thumb__)
// TODO this needs a better way of testing for Thumb2 FP hardware
#if defined(__thumb2__)
float sqrtf(float x) {
asm volatile (
"vsqrt.f32 %[r], %[x]\n"
: [r] "=t" (x)
: [x] "t" (x));
return x;
}
#endif
#ifndef NDEBUG #ifndef NDEBUG
float copysignf(float x, float y) { float copysignf(float x, float y) {
float_s_t fx={.f = x}; float_s_t fx={.f = x};
......
// an implementation of sqrtf for Thumb using hardware VFP instructions
#include <math.h>
float sqrtf(float x) {
asm volatile (
"vsqrt.f32 %[r], %[x]\n"
: [r] "=t" (x)
: [x] "t" (x));
return x;
}
...@@ -81,6 +81,7 @@ endif ...@@ -81,6 +81,7 @@ endif
SRC_LIB = $(addprefix lib/,\ SRC_LIB = $(addprefix lib/,\
libc/string0.c \ libc/string0.c \
libm/math.c \ libm/math.c \
libm/thumb_vfp_sqrtf.c \
libm/asinfacosf.c \ libm/asinfacosf.c \
libm/atanf.c \ libm/atanf.c \
libm/atan2f.c \ libm/atan2f.c \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment