From 94f744195e17cf787a36c259254d56386b31fe20 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 23 Jun 2017 16:01:00 -0400 Subject: 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. --- src/math/powerpc64/lroundf.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/math/powerpc64/lroundf.c (limited to 'src/math/powerpc64/lroundf.c') diff --git a/src/math/powerpc64/lroundf.c b/src/math/powerpc64/lroundf.c new file mode 100644 index 00000000..033094ff --- /dev/null +++ b/src/math/powerpc64/lroundf.c @@ -0,0 +1,18 @@ +#include + +#ifdef __VSX__ + +long lroundf(float x) +{ + long n; + __asm__ ( + "xsrdpi %1, %1\n" + "fctid %0, %1\n" : "=d"(n), "+f"(x)); + return n; +} + +#else + +#include "../lroundf.c" + +#endif -- cgit v1.2.1