diff options
author | Uros Bizjak <uros@gcc.gnu.org> | 2008-03-04 14:57:27 +0100 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2008-03-04 14:57:27 +0100 |
commit | 5ce0e197751a14209bb632fb8b5ed6375376de38 (patch) | |
tree | 2b0fdb445e4a37df145f47915302d260202d1164 /gcc/fold-const.c | |
parent | e0898f4cedf01f4f96da684d329e35805a76d32d (diff) | |
download | gcc-5ce0e197751a14209bb632fb8b5ed6375376de38.zip gcc-5ce0e197751a14209bb632fb8b5ed6375376de38.tar.gz gcc-5ce0e197751a14209bb632fb8b5ed6375376de38.tar.bz2 |
re PR middle-end/35456 (Different results for inlined vs. non-inlined function)
PR middle-end/35456
* fold-const.c (fold_cond_expr_with_comparison): Prevent
transformations for modes that have signed zeros.
* ifcvt.c (noce_try_abs): Ditto.
testsuite/ChangeLog:
PR middle-end/35456
* gcc.c-torture/execute/pr35456.c: New test.
From-SVN: r132863
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 6a70e17..f6466f7 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -5072,9 +5072,10 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2) Note that all these transformations are correct if A is NaN, since the two alternatives (A and -A) are also NaNs. */ - if ((FLOAT_TYPE_P (TREE_TYPE (arg01)) - ? real_zerop (arg01) - : integer_zerop (arg01)) + if (!HONOR_SIGNED_ZEROS (TYPE_MODE (type)) + && (FLOAT_TYPE_P (TREE_TYPE (arg01)) + ? real_zerop (arg01) + : integer_zerop (arg01)) && ((TREE_CODE (arg2) == NEGATE_EXPR && operand_equal_p (TREE_OPERAND (arg2, 0), arg1, 0)) /* In the case that A is of the form X-Y, '-A' (arg2) may @@ -5127,7 +5128,8 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2) both transformations are correct when A is NaN: A != 0 is then true, and A == 0 is false. */ - if (integer_zerop (arg01) && integer_zerop (arg2)) + if (!HONOR_SIGNED_ZEROS (TYPE_MODE (type)) + && integer_zerop (arg01) && integer_zerop (arg2)) { if (comp_code == NE_EXPR) return pedantic_non_lvalue (fold_convert (type, arg1)); @@ -5161,7 +5163,8 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2) a number and A is not. The conditions in the original expressions will be false, so all four give B. The min() and max() versions would give a NaN instead. */ - if (operand_equal_for_comparison_p (arg01, arg2, arg00) + if (!HONOR_SIGNED_ZEROS (TYPE_MODE (type)) + && operand_equal_for_comparison_p (arg01, arg2, arg00) /* Avoid these transformations if the COND_EXPR may be used as an lvalue in the C++ front-end. PR c++/19199. */ && (in_gimple_form |