From ce385fcfb2db74b109067083db4a26ca810eaa14 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 23 Jun 2017 15:28:10 -0400 Subject: 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. --- src/math/s390x/nearbyintl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/math/s390x/nearbyintl.c (limited to 'src/math/s390x/nearbyintl.c') diff --git a/src/math/s390x/nearbyintl.c b/src/math/s390x/nearbyintl.c new file mode 100644 index 00000000..b4bd5523 --- /dev/null +++ b/src/math/s390x/nearbyintl.c @@ -0,0 +1,15 @@ +#include + +#if defined(__HTM__) || __ARCH__ >= 9 + +long double nearbyintl(long double x) +{ + __asm__ ("fixbra %0, 0, %1, 4" : "=f"(x) : "f"(x)); + return x; +} + +#else + +#include "../nearbyintl.c" + +#endif -- cgit v1.2.1