forked from pool/glibc
Andreas Schwab
ef65d0fef2
- pkey-get-reserved-name.patch: Linux: use reserved name __key in pkey_get (BZ #22797) - aarch64-sys-ptrace-update.patch: linux/aarch64: sync sys/ptrace.h with Linux 4.15 (BZ #22433) - powerpc-sys-ptrace-undefine-macros.patch: powerpc: Undefine Linux ptrace macros that conflict with __ptrace_request - powerpc-sys-ptrace-update.patch: linux/powerpc: sync sys/ptrace.h with Linux 4.15 (BZ #22433, BZ #22807) - netgroup-cache-keys.patch: Fix netgroup cache keys (BZ #22342) - i386-sigaction-sa-restorer.patch: i386: Fix i386 sigaction sa_restorer initialization (BZ #21269) - riscv-tls-init.patch: RISC-V: Do not initialize $gp in TLS macros - riscv-fmax-fmin-nan.patch: RISC-V: fmax/fmin: Handle signalling NaNs correctly (BZ #22884) OBS-URL: https://build.opensuse.org/request/show/590321 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=499
113 lines
3.0 KiB
Diff
113 lines
3.0 KiB
Diff
2018-02-22 Andrew Waterman <andrew@sifive.com>
|
|
|
|
[BZ # 22884]
|
|
* sysdeps/riscv/rvd/s_fmax.c (__fmax): Handle sNaNs correctly.
|
|
* sysdeps/riscv/rvd/s_fmin.c (__fmin): Likewise.
|
|
* sysdeps/riscv/rvf/s_fmaxf.c (__fmaxf): Likewise.
|
|
* sysdeps/riscv/rvf/s_fminf.c (__fminf): Likewise.
|
|
|
|
Index: glibc-2.27/sysdeps/riscv/rvd/s_fmax.c
|
|
===================================================================
|
|
--- glibc-2.27.orig/sysdeps/riscv/rvd/s_fmax.c
|
|
+++ glibc-2.27/sysdeps/riscv/rvd/s_fmax.c
|
|
@@ -17,12 +17,19 @@
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include <math.h>
|
|
+#include <math_private.h>
|
|
#include <libm-alias-double.h>
|
|
|
|
double
|
|
__fmax (double x, double y)
|
|
{
|
|
- asm ("fmax.d %0, %1, %2" : "=f" (x) : "f" (x), "f" (y));
|
|
- return x;
|
|
+ double res;
|
|
+
|
|
+ if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN))
|
|
+ return x + y;
|
|
+ else
|
|
+ asm ("fmax.d %0, %1, %2" : "=f" (res) : "f" (x), "f" (y));
|
|
+
|
|
+ return res;
|
|
}
|
|
libm_alias_double (__fmax, fmax)
|
|
Index: glibc-2.27/sysdeps/riscv/rvd/s_fmin.c
|
|
===================================================================
|
|
--- glibc-2.27.orig/sysdeps/riscv/rvd/s_fmin.c
|
|
+++ glibc-2.27/sysdeps/riscv/rvd/s_fmin.c
|
|
@@ -17,12 +17,19 @@
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include <math.h>
|
|
+#include <math_private.h>
|
|
#include <libm-alias-double.h>
|
|
|
|
double
|
|
__fmin (double x, double y)
|
|
{
|
|
- asm ("fmin.d %0, %1, %2" : "=f" (x) : "f" (x), "f" (y));
|
|
- return x;
|
|
+ double res;
|
|
+
|
|
+ if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN))
|
|
+ return x + y;
|
|
+ else
|
|
+ asm ("fmin.d %0, %1, %2" : "=f" (res) : "f" (x), "f" (y));
|
|
+
|
|
+ return res;
|
|
}
|
|
libm_alias_double (__fmin, fmin)
|
|
Index: glibc-2.27/sysdeps/riscv/rvf/s_fmaxf.c
|
|
===================================================================
|
|
--- glibc-2.27.orig/sysdeps/riscv/rvf/s_fmaxf.c
|
|
+++ glibc-2.27/sysdeps/riscv/rvf/s_fmaxf.c
|
|
@@ -17,12 +17,19 @@
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include <math.h>
|
|
+#include <math_private.h>
|
|
#include <libm-alias-float.h>
|
|
|
|
float
|
|
__fmaxf (float x, float y)
|
|
{
|
|
- asm ("fmax.s %0, %1, %2" : "=f" (x) : "f" (x), "f" (y));
|
|
- return x;
|
|
+ float res;
|
|
+
|
|
+ if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN))
|
|
+ return x + y;
|
|
+ else
|
|
+ asm ("fmax.s %0, %1, %2" : "=f" (res) : "f" (x), "f" (y));
|
|
+
|
|
+ return res;
|
|
}
|
|
libm_alias_float (__fmax, fmax)
|
|
Index: glibc-2.27/sysdeps/riscv/rvf/s_fminf.c
|
|
===================================================================
|
|
--- glibc-2.27.orig/sysdeps/riscv/rvf/s_fminf.c
|
|
+++ glibc-2.27/sysdeps/riscv/rvf/s_fminf.c
|
|
@@ -17,12 +17,19 @@
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include <math.h>
|
|
+#include <math_private.h>
|
|
#include <libm-alias-float.h>
|
|
|
|
float
|
|
__fminf (float x, float y)
|
|
{
|
|
- asm ("fmin.s %0, %1, %2" : "=f" (x) : "f" (x), "f" (y));
|
|
- return x;
|
|
+ float res;
|
|
+
|
|
+ if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN))
|
|
+ return x + y;
|
|
+ else
|
|
+ asm ("fmin.s %0, %1, %2" : "=f" (res) : "f" (x), "f" (y));
|
|
+
|
|
+ return res;
|
|
}
|
|
libm_alias_float (__fmin, fmin)
|