diff options
author | Rich Felker <dalias@aerifal.cx> | 2017-06-23 16:01:00 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2017-06-23 16:01:00 -0400 |
commit | 94f744195e17cf787a36c259254d56386b31fe20 (patch) | |
tree | 6702e9ebf15bd4db3049d769fd06bd51abe124d8 /src/math/powerpc64/round.c | |
parent | 9d12a6a21fd146f543e8a6b8ec4cce7fd61be606 (diff) | |
download | musl-94f744195e17cf787a36c259254d56386b31fe20.tar.gz musl-94f744195e17cf787a36c259254d56386b31fe20.tar.xz musl-94f744195e17cf787a36c259254d56386b31fe20.zip |
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/round.c')
-rw-r--r-- | src/math/powerpc64/round.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/math/powerpc64/round.c b/src/math/powerpc64/round.c new file mode 100644 index 00000000..4b9318e0 --- /dev/null +++ b/src/math/powerpc64/round.c @@ -0,0 +1,15 @@ +#include <math.h> + +#ifdef _ARCH_PWR5X + +double round(double x) +{ + __asm__ ("frin %0, %1" : "=d"(x) : "d"(x)); + return x; +} + +#else + +#include "../round.c" + +#endif |