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/round.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/math/s390x/round.c (limited to 'src/math/s390x/round.c') diff --git a/src/math/s390x/round.c b/src/math/s390x/round.c new file mode 100644 index 00000000..71f80251 --- /dev/null +++ b/src/math/s390x/round.c @@ -0,0 +1,15 @@ +#include + +#if defined(__HTM__) || __ARCH__ >= 9 + +double round(double x) +{ + __asm__ ("fidbra %0, 1, %1, 4" : "=f"(x) : "f"(x)); + return x; +} + +#else + +#include "../round.c" + +#endif -- cgit v1.2.3-70-g09d2