summaryrefslogtreecommitdiff
path: root/src/math/powerpc64/floorf.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2017-06-23 16:01:00 -0400
committerRich Felker <dalias@aerifal.cx>2017-06-23 16:01:00 -0400
commit94f744195e17cf787a36c259254d56386b31fe20 (patch)
tree6702e9ebf15bd4db3049d769fd06bd51abe124d8 /src/math/powerpc64/floorf.c
parent9d12a6a21fd146f543e8a6b8ec4cce7fd61be606 (diff)
downloadmusl-94f744195e17cf787a36c259254d56386b31fe20.tar.gz
powerpc64: add single-instruction math functions
while the official elfv2 abi for "powerpc64le" sets power8 as the baseline isa, we use it for both little and big endian powerpc64 targets and need to maintain compatibility with pre-power8 models. the instructions for sqrt, fabs, and fma are in the baseline isa; support for the rest is conditional via predefined isa-level macros. patch by David Edelsohn.
Diffstat (limited to 'src/math/powerpc64/floorf.c')
-rw-r--r--src/math/powerpc64/floorf.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/math/powerpc64/floorf.c b/src/math/powerpc64/floorf.c
new file mode 100644
index 00000000..e1031ef4
--- /dev/null
+++ b/src/math/powerpc64/floorf.c
@@ -0,0 +1,15 @@
+#include <math.h>
+
+#ifdef _ARCH_PWR5X
+
+float floorf(float x)
+{
+ __asm__ ("frim %0, %1" : "=f"(x) : "f"(x));
+ return x;
+}
+
+#else
+
+#include "../floorf.c"
+
+#endif