aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--sysdeps/mips/mips32/sfp-machine.h14
-rw-r--r--sysdeps/mips/mips64/sfp-machine.h14
3 files changed, 30 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 32dee3fcb3..0278dff4cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2017-01-04 Joseph Myers <joseph@codesourcery.com>
+ * sysdeps/mips/mips32/sfp-machine.h (_FP_CHOOSENAN): Always
+ preserve NaN payload if [__mips_nan2008].
+ * sysdeps/mips/mips64/sfp-machine.h (_FP_CHOOSENAN): Likewise.
+
[BZ #21022]
* sysdeps/microblaze/backtrace.c (get_frame_size): Make static.
diff --git a/sysdeps/mips/mips32/sfp-machine.h b/sysdeps/mips/mips32/sfp-machine.h
index 4e23aa8b26..5215655029 100644
--- a/sysdeps/mips/mips32/sfp-machine.h
+++ b/sysdeps/mips/mips32/sfp-machine.h
@@ -41,9 +41,20 @@
# define _FP_QNANNEGATEDP 1
#endif
+#ifdef __mips_nan2008
+/* NaN payloads should be preserved for NAN2008. */
+# define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
+ do \
+ { \
+ R##_s = X##_s; \
+ _FP_FRAC_COPY_##wc (R, X); \
+ R##_c = FP_CLS_NAN; \
+ } \
+ while (0)
+#else
/* From my experiments it seems X is chosen unless one of the
NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */
-#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
+# define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
do { \
if ((_FP_FRAC_HIGH_RAW_##fs(X) | \
_FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs) \
@@ -58,6 +69,7 @@
} \
R##_c = FP_CLS_NAN; \
} while (0)
+#endif
#define FP_EX_INVALID (1 << 4)
#define FP_EX_DIVZERO (1 << 3)
diff --git a/sysdeps/mips/mips64/sfp-machine.h b/sysdeps/mips/mips64/sfp-machine.h
index 708afc783e..35cc4ddeb1 100644
--- a/sysdeps/mips/mips64/sfp-machine.h
+++ b/sysdeps/mips/mips64/sfp-machine.h
@@ -44,9 +44,20 @@
# define _FP_QNANNEGATEDP 1
#endif
+#ifdef __mips_nan2008
+/* NaN payloads should be preserved for NAN2008. */
+# define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
+ do \
+ { \
+ R##_s = X##_s; \
+ _FP_FRAC_COPY_##wc (R, X); \
+ R##_c = FP_CLS_NAN; \
+ } \
+ while (0)
+#else
/* From my experiments it seems X is chosen unless one of the
NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */
-#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
+# define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
do { \
if ((_FP_FRAC_HIGH_RAW_##fs(X) | \
_FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs) \
@@ -61,6 +72,7 @@
} \
R##_c = FP_CLS_NAN; \
} while (0)
+#endif
#define _FP_DECL_EX fpu_control_t _fcw