summaryrefslogtreecommitdiff
path: root/src/math/s390x/sqrtf.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2017-06-23 15:28:10 -0400
committerRich Felker <dalias@aerifal.cx>2017-06-23 15:28:10 -0400
commitce385fcfb2db74b109067083db4a26ca810eaa14 (patch)
treef759439c9cf1c25ea52f1488d6441dcb30b1b28d /src/math/s390x/sqrtf.c
parente6def544358afd5648a428d2e02c147a1f901048 (diff)
downloadmusl-ce385fcfb2db74b109067083db4a26ca810eaa14.tar.gz
musl-ce385fcfb2db74b109067083db4a26ca810eaa14.tar.bz2
musl-ce385fcfb2db74b109067083db4a26ca810eaa14.tar.xz
musl-ce385fcfb2db74b109067083db4a26ca810eaa14.zip
s390x: add single-instruction math functions
these were introduced in z196 and not available in the baseline (z900) ISA level. use __HTM__ as an alternate indicator for ISA level, since gcc did not define __ARCH__ until 7.x. patch by David Edelsohn.
Diffstat (limited to 'src/math/s390x/sqrtf.c')
-rw-r--r--src/math/s390x/sqrtf.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/math/s390x/sqrtf.c b/src/math/s390x/sqrtf.c
new file mode 100644
index 00000000..52f57eb9
--- /dev/null
+++ b/src/math/s390x/sqrtf.c
@@ -0,0 +1,15 @@
+#include <math.h>
+
+#if defined(__HTM__) || __ARCH__ >= 9
+
+float sqrtf(float x)
+{
+ __asm__ ("sqebr %0, %1" : "=f"(x) : "f"(x));
+ return x;
+}
+
+#else
+
+#include "../sqrtf.c"
+
+#endif