micropython/lib/libm/thumb_vfp_sqrtf.c

12 lines
244 B
C
Raw Normal View History

// 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;
}