summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorssaraswati <ssaraswati@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-20 09:13:51 +0000
committerssaraswati <ssaraswati@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-20 09:13:51 +0000
commitb9333137494f7d00bba18c9c2a53769f3a790c70 (patch)
tree62f0bdc62d4027b4d465778be408d23f54f86398
parente98da821c1ee4450bbe40a0278cd75803706aa7c (diff)
downloadgcc-b9333137494f7d00bba18c9c2a53769f3a790c70.tar.gz
This series of patches are for fixing PR61441. This patch modifies code to use
REAL_VALUE_ISSIGNALING_NAN instead of REAL_VALUE_ISNAN to avoid the operatins only for sNaN operands. Bootstrapped & regression-tested on x86_64-linux-gnu. gcc/ * fold-const.c (const_binop): Use REAL_VALUE_ISSIGNALING_NAN instead of REAL_VALUE_ISNAN to avoid the operation for sNaN operands. * simplify-rtx.c (simplify_const_binary_operation): Same. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231857 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/fold-const.c5
-rw-r--r--gcc/simplify-rtx.c3
3 files changed, 12 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5baddef391e..b7a146961f6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-12-20 Sujoy Saraswati <sujoy.saraswati@hpe.com>
+
+ PR tree-optimization/61441
+ * fold-const.c (const_binop): Use REAL_VALUE_ISSIGNALING_NAN instead
+ of REAL_VALUE_ISNAN to avoid the operation for sNaN operands.
+ * simplify-rtx.c (simplify_const_binary_operation): Same.
+
2015-12-19 Jan Hubicka <hubicka@ucw.cz>
PR middle-end/65337
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 553a9c37d7a..fff0285bd13 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1150,9 +1150,10 @@ const_binop (enum tree_code code, tree arg1, tree arg2)
mode = TYPE_MODE (type);
/* Don't perform operation if we honor signaling NaNs and
- either operand is a NaN. */
+ either operand is a signaling NaN. */
if (HONOR_SNANS (mode)
- && (REAL_VALUE_ISNAN (d1) || REAL_VALUE_ISNAN (d2)))
+ && (REAL_VALUE_ISSIGNALING_NAN (d1)
+ || REAL_VALUE_ISSIGNALING_NAN (d2)))
return NULL_TREE;
/* Don't perform operation if it would raise a division
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 413d61b1759..225742ec73e 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3892,7 +3892,8 @@ simplify_const_binary_operation (enum rtx_code code, machine_mode mode,
real_convert (&f1, mode, CONST_DOUBLE_REAL_VALUE (op1));
if (HONOR_SNANS (mode)
- && (REAL_VALUE_ISNAN (f0) || REAL_VALUE_ISNAN (f1)))
+ && (REAL_VALUE_ISSIGNALING_NAN (f0)
+ || REAL_VALUE_ISSIGNALING_NAN (f1)))
return 0;
if (code == DIV