|
|
7c0489 |
From 855d045bc26175195dadafc28abf84e7b6613aac Mon Sep 17 00:00:00 2001
|
|
|
7c0489 |
From: Stefan Liebler <stli@linux.ibm.com>
|
|
|
7c0489 |
Date: Wed, 11 Dec 2019 15:09:28 +0100
|
|
|
7c0489 |
Subject: [PATCH 19/28] S390: Use load-fp-integer instruction for roundeven
|
|
|
7c0489 |
functions.
|
|
|
7c0489 |
|
|
|
7c0489 |
If compiled with z196 zarch support, the load-fp-integer instruction
|
|
|
7c0489 |
is used to implement roundeven, roundevenf, roundevenl.
|
|
|
7c0489 |
Otherwise the common-code implementation is used.
|
|
|
7c0489 |
|
|
|
7c0489 |
(cherry picked from commit 4399b163376b331773e43917dcf56ce68e43e6a0)
|
|
|
7c0489 |
---
|
|
|
7c0489 |
sysdeps/s390/fpu/s_roundeven.c | 39 +++++++++++++++++++++++++++++++++
|
|
|
7c0489 |
sysdeps/s390/fpu/s_roundevenf.c | 38 ++++++++++++++++++++++++++++++++
|
|
|
7c0489 |
sysdeps/s390/fpu/s_roundevenl.c | 39 +++++++++++++++++++++++++++++++++
|
|
|
7c0489 |
3 files changed, 116 insertions(+)
|
|
|
7c0489 |
create mode 100644 sysdeps/s390/fpu/s_roundeven.c
|
|
|
7c0489 |
create mode 100644 sysdeps/s390/fpu/s_roundevenf.c
|
|
|
7c0489 |
create mode 100644 sysdeps/s390/fpu/s_roundevenl.c
|
|
|
7c0489 |
|
|
|
7c0489 |
diff --git a/sysdeps/s390/fpu/s_roundeven.c b/sysdeps/s390/fpu/s_roundeven.c
|
|
|
7c0489 |
new file mode 100644
|
|
|
7c0489 |
index 0000000000..95a83a70e8
|
|
|
7c0489 |
--- /dev/null
|
|
|
7c0489 |
+++ b/sysdeps/s390/fpu/s_roundeven.c
|
|
|
7c0489 |
@@ -0,0 +1,39 @@
|
|
|
7c0489 |
+/* roundeven() - S390 version.
|
|
|
7c0489 |
+ Copyright (C) 2019 Free Software Foundation, Inc.
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+ This file is part of the GNU C Library.
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
7c0489 |
+ modify it under the terms of the GNU Lesser General Public License as
|
|
|
7c0489 |
+ published by the Free Software Foundation; either version 2.1 of the
|
|
|
7c0489 |
+ License, or (at your option) any later version.
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
7c0489 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
7c0489 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
7c0489 |
+ Lesser General Public License for more details.
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
7c0489 |
+ License along with the GNU C Library; if not, see
|
|
|
7c0489 |
+ <https://www.gnu.org/licenses/>. */
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
|
|
|
7c0489 |
+# include <math.h>
|
|
|
7c0489 |
+# include <libm-alias-double.h>
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+double
|
|
|
7c0489 |
+__roundeven (double x)
|
|
|
7c0489 |
+{
|
|
|
7c0489 |
+ double y;
|
|
|
7c0489 |
+ /* The z196 zarch "load fp integer" (fidbra) instruction is rounding
|
|
|
7c0489 |
+ x to the nearest integer with "ties to even" rounding mode
|
|
|
7c0489 |
+ (M3-field: 4) where inexact exceptions are suppressed (M4-field: 4). */
|
|
|
7c0489 |
+ __asm__ ("fidbra %0,4,%1,4" : "=f" (y) : "f" (x));
|
|
|
7c0489 |
+ return y;
|
|
|
7c0489 |
+}
|
|
|
7c0489 |
+hidden_def (__roundeven)
|
|
|
7c0489 |
+libm_alias_double (__roundeven, roundeven)
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+#else
|
|
|
7c0489 |
+# include <sysdeps/ieee754/dbl-64/s_roundeven.c>
|
|
|
7c0489 |
+#endif
|
|
|
7c0489 |
diff --git a/sysdeps/s390/fpu/s_roundevenf.c b/sysdeps/s390/fpu/s_roundevenf.c
|
|
|
7c0489 |
new file mode 100644
|
|
|
7c0489 |
index 0000000000..c620a0189c
|
|
|
7c0489 |
--- /dev/null
|
|
|
7c0489 |
+++ b/sysdeps/s390/fpu/s_roundevenf.c
|
|
|
7c0489 |
@@ -0,0 +1,38 @@
|
|
|
7c0489 |
+/* roundevenf() - S390 version.
|
|
|
7c0489 |
+ Copyright (C) 2019 Free Software Foundation, Inc.
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+ This file is part of the GNU C Library.
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
7c0489 |
+ modify it under the terms of the GNU Lesser General Public License as
|
|
|
7c0489 |
+ published by the Free Software Foundation; either version 2.1 of the
|
|
|
7c0489 |
+ License, or (at your option) any later version.
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
7c0489 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
7c0489 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
7c0489 |
+ Lesser General Public License for more details.
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
7c0489 |
+ License along with the GNU C Library; if not, see
|
|
|
7c0489 |
+ <https://www.gnu.org/licenses/>. */
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
|
|
|
7c0489 |
+# include <math.h>
|
|
|
7c0489 |
+# include <libm-alias-float.h>
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+float
|
|
|
7c0489 |
+__roundevenf (float x)
|
|
|
7c0489 |
+{
|
|
|
7c0489 |
+ float y;
|
|
|
7c0489 |
+ /* The z196 zarch "load fp integer" (fiebra) instruction is rounding
|
|
|
7c0489 |
+ x to the nearest integer with "ties to even" rounding mode
|
|
|
7c0489 |
+ (M3-field: 4) where inexact exceptions are suppressed (M4-field: 4). */
|
|
|
7c0489 |
+ __asm__ ("fiebra %0,4,%1,4" : "=f" (y) : "f" (x));
|
|
|
7c0489 |
+ return y;
|
|
|
7c0489 |
+}
|
|
|
7c0489 |
+libm_alias_float (__roundeven, roundeven)
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+#else
|
|
|
7c0489 |
+# include <sysdeps/ieee754/flt-32/s_roundevenf.c>
|
|
|
7c0489 |
+#endif
|
|
|
7c0489 |
diff --git a/sysdeps/s390/fpu/s_roundevenl.c b/sysdeps/s390/fpu/s_roundevenl.c
|
|
|
7c0489 |
new file mode 100644
|
|
|
7c0489 |
index 0000000000..3481af2665
|
|
|
7c0489 |
--- /dev/null
|
|
|
7c0489 |
+++ b/sysdeps/s390/fpu/s_roundevenl.c
|
|
|
7c0489 |
@@ -0,0 +1,39 @@
|
|
|
7c0489 |
+/* roundevenl() - S390 version.
|
|
|
7c0489 |
+ Copyright (C) 2019 Free Software Foundation, Inc.
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+ This file is part of the GNU C Library.
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
7c0489 |
+ modify it under the terms of the GNU Lesser General Public License as
|
|
|
7c0489 |
+ published by the Free Software Foundation; either version 2.1 of the
|
|
|
7c0489 |
+ License, or (at your option) any later version.
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
7c0489 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
7c0489 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
7c0489 |
+ Lesser General Public License for more details.
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
7c0489 |
+ License along with the GNU C Library; if not, see
|
|
|
7c0489 |
+ <https://www.gnu.org/licenses/>. */
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
|
|
|
7c0489 |
+# include <math.h>
|
|
|
7c0489 |
+# include <math_private.h>
|
|
|
7c0489 |
+# include <libm-alias-ldouble.h>
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+_Float128
|
|
|
7c0489 |
+__roundevenl (_Float128 x)
|
|
|
7c0489 |
+{
|
|
|
7c0489 |
+ _Float128 y;
|
|
|
7c0489 |
+ /* The z196 zarch "load fp integer" (fixbra) instruction is rounding
|
|
|
7c0489 |
+ x to the nearest integer with "ties to even" rounding mode
|
|
|
7c0489 |
+ (M3-field: 4) where inexact exceptions are suppressed (M4-field: 4). */
|
|
|
7c0489 |
+ __asm__ ("fixbra %0,4,%1,4" : "=f" (y) : "f" (x));
|
|
|
7c0489 |
+ return y;
|
|
|
7c0489 |
+}
|
|
|
7c0489 |
+libm_alias_ldouble (__roundeven, roundeven)
|
|
|
7c0489 |
+
|
|
|
7c0489 |
+#else
|
|
|
7c0489 |
+# include <sysdeps/ieee754/ldbl-128/s_roundevenl.c>
|
|
|
7c0489 |
+#endif
|
|
|
7c0489 |
--
|
|
|
7c0489 |
2.18.2
|
|
|
7c0489 |
|