diff options
author | Richard Guenther <rguenther@suse.de> | 2006-10-24 09:15:07 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2006-10-24 09:15:07 +0000 |
commit | 27d7d0422ce932e1f531fec5de9b81bced2f369b (patch) | |
tree | 7a70218041825ef460b80274878b0b9a76fd0182 /gcc/builtins.c | |
parent | e1502f6e2de6e37603adb0e415a5d9847bfaf990 (diff) | |
download | gcc-27d7d0422ce932e1f531fec5de9b81bced2f369b.zip gcc-27d7d0422ce932e1f531fec5de9b81bced2f369b.tar.gz gcc-27d7d0422ce932e1f531fec5de9b81bced2f369b.tar.bz2 |
re PR middle-end/28796 (__builtin_nan() and __builtin_unordered() inconsistent)
2006-10-24 Richard Guenther <rguenther@suse.de>
PR middle-end/28796
* builtins.c (fold_builtin_classify): Use HONOR_INFINITIES
and HONOR_NANS instead of MODE_HAS_INFINITIES and MODE_HAS_NANS
for deciding optimizations in consistency with fold-const.c
(fold_builtin_unordered_cmp): Likewise.
* gcc.dg/pr28796-1.c: New testcase.
* gcc.dg/pr28796-1.c: Likewise.
From-SVN: r118001
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 78fc11f..f77f8b2 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -8776,7 +8776,7 @@ fold_builtin_classify (tree fndecl, tree arglist, int builtin_index) switch (builtin_index) { case BUILT_IN_ISINF: - if (!MODE_HAS_INFINITIES (TYPE_MODE (TREE_TYPE (arg)))) + if (!HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (arg)))) return omit_one_operand (type, integer_zero_node, arg); if (TREE_CODE (arg) == REAL_CST) @@ -8792,8 +8792,8 @@ fold_builtin_classify (tree fndecl, tree arglist, int builtin_index) return NULL_TREE; case BUILT_IN_FINITE: - if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg))) - && !MODE_HAS_INFINITIES (TYPE_MODE (TREE_TYPE (arg)))) + if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg))) + && !HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (arg)))) return omit_one_operand (type, integer_one_node, arg); if (TREE_CODE (arg) == REAL_CST) @@ -8806,7 +8806,7 @@ fold_builtin_classify (tree fndecl, tree arglist, int builtin_index) return NULL_TREE; case BUILT_IN_ISNAN: - if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg)))) + if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg)))) return omit_one_operand (type, integer_zero_node, arg); if (TREE_CODE (arg) == REAL_CST) @@ -8889,13 +8889,13 @@ fold_builtin_unordered_cmp (tree fndecl, tree arglist, if (unordered_code == UNORDERED_EXPR) { - if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg0)))) + if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0)))) return omit_two_operands (type, integer_zero_node, arg0, arg1); return fold_build2 (UNORDERED_EXPR, type, arg0, arg1); } - code = MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg0))) ? unordered_code - : ordered_code; + code = HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0))) ? unordered_code + : ordered_code; return fold_build1 (TRUTH_NOT_EXPR, type, fold_build2 (code, type, arg0, arg1)); } |