diff options
Diffstat (limited to 'lib/libm/thumb_vfp_sqrtf.c')
-rw-r--r-- | lib/libm/thumb_vfp_sqrtf.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libm/thumb_vfp_sqrtf.c b/lib/libm/thumb_vfp_sqrtf.c new file mode 100644 index 0000000000..12ffebf827 --- /dev/null +++ b/lib/libm/thumb_vfp_sqrtf.c @@ -0,0 +1,11 @@ +// 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; +} |