summaryrefslogtreecommitdiffstatshomepage
path: root/lib/libm/thumb_vfp_sqrtf.c
blob: 12ffebf827090b9969df7fcecba86161847af8f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
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;
}