summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libm_dbl/thumb_vfp_sqrt.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libm_dbl/thumb_vfp_sqrt.c b/lib/libm_dbl/thumb_vfp_sqrt.c
new file mode 100644
index 000000000..dd37a07b0
--- /dev/null
+++ b/lib/libm_dbl/thumb_vfp_sqrt.c
@@ -0,0 +1,10 @@
+// an implementation of sqrt for Thumb using hardware double-precision VFP instructions
+
+double sqrt(double x) {
+ double ret;
+ asm volatile (
+ "vsqrt.f64 %P0, %P1\n"
+ : "=w" (ret)
+ : "w" (x));
+ return ret;
+}