aboutsummaryrefslogtreecommitdiff
path: root/circuitpython/lib/libm/thumb_vfp_sqrtf.c
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2022-06-19 19:47:51 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2022-06-19 19:47:51 +0530
commit4fd287655a72b9aea14cdac715ad5b90ed082ed2 (patch)
tree65d393bc0e699dd12d05b29ba568e04cea666207 /circuitpython/lib/libm/thumb_vfp_sqrtf.c
parent0150f70ce9c39e9e6dd878766c0620c85e47bed0 (diff)
add circuitpython code
Diffstat (limited to 'circuitpython/lib/libm/thumb_vfp_sqrtf.c')
-rw-r--r--circuitpython/lib/libm/thumb_vfp_sqrtf.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/circuitpython/lib/libm/thumb_vfp_sqrtf.c b/circuitpython/lib/libm/thumb_vfp_sqrtf.c
new file mode 100644
index 0000000..12ffebf
--- /dev/null
+++ b/circuitpython/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;
+}