diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2017-11-07 12:04:14 +0100 |
---|---|---|
committer | Marc Glisse <glisse@gcc.gnu.org> | 2017-11-07 11:04:14 +0000 |
commit | 81bd903a6aa90326fb2a3cb451f86423f069793b (patch) | |
tree | d4d7509c7039e1f2279eb7a947b41a5781f7d6ce /gcc/fold-const.c | |
parent | 13792cce5f6b3f01081eda5b4f0326a0aac4f368 (diff) | |
download | gcc-81bd903a6aa90326fb2a3cb451f86423f069793b.zip gcc-81bd903a6aa90326fb2a3cb451f86423f069793b.tar.gz gcc-81bd903a6aa90326fb2a3cb451f86423f069793b.tar.bz2 |
More fold_negate in match.pd
gcc/ChangeLog:
2017-11-07 Marc Glisse <marc.glisse@inria.fr>
* fold-const.c (negate_expr_p) [PLUS_EXPR, MINUS_EXPR]: Handle
non-scalar integral types.
* match.pd (negate_expr_p): Handle MINUS_EXPR.
(-(A-B), -(~A)): New transformations.
gcc/testsuite/ChangeLog:
2017-11-07 Marc Glisse <marc.glisse@inria.fr>
* gcc.dg/tree-ssa/negminus.c: New test.
From-SVN: r254494
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1109f5e..e9cd968 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -428,7 +428,7 @@ negate_expr_p (tree t) case PLUS_EXPR: if (HONOR_SIGN_DEPENDENT_ROUNDING (element_mode (type)) || HONOR_SIGNED_ZEROS (element_mode (type)) - || (INTEGRAL_TYPE_P (type) + || (ANY_INTEGRAL_TYPE_P (type) && ! TYPE_OVERFLOW_WRAPS (type))) return false; /* -(A + B) -> (-B) - A. */ @@ -441,7 +441,7 @@ negate_expr_p (tree t) /* We can't turn -(A-B) into B-A when we honor signed zeros. */ return !HONOR_SIGN_DEPENDENT_ROUNDING (element_mode (type)) && !HONOR_SIGNED_ZEROS (element_mode (type)) - && (! INTEGRAL_TYPE_P (type) + && (! ANY_INTEGRAL_TYPE_P (type) || TYPE_OVERFLOW_WRAPS (type)); case MULT_EXPR: |