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/fmaxf.c | |
parent | 9d12a6a21fd146f543e8a6b8ec4cce7fd61be606 (diff) | |
download | musl-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/fmaxf.c')
-rw-r--r-- | src/math/powerpc64/fmaxf.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/math/powerpc64/fmaxf.c b/src/math/powerpc64/fmaxf.c new file mode 100644 index 00000000..345a234a --- /dev/null +++ b/src/math/powerpc64/fmaxf.c @@ -0,0 +1,15 @@ +#include <math.h> + +#ifdef __VSX__ + +float fmaxf(float x, float y) +{ + __asm__ ("xsmaxdp %x0, %x1, %x2" : "=ww"(x) : "ww"(x), "ww"(y)); + return x; +} + +#else + +#include "../fmaxf.c" + +#endif |