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