From c3aa270e6bb5013303ccf3b7bbb68d90b0ea2242 Mon Sep 17 00:00:00 2001 From: glisse Date: Tue, 7 Nov 2017 11:04:14 +0000 Subject: More fold_negate in match.pd gcc/ChangeLog: 2017-11-07 Marc Glisse * 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 * gcc.dg/tree-ssa/negminus.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254494 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fold-const.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/fold-const.c') diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1109f5e3bc5..e9cd968887f 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: -- cgit v1.2.1