From: Richard Biener Date: Tue, 4 Oct 2016 13:18:18 +0000 (+0000) Subject: re PR middle-end/77407 (Optimize integer i / abs (i) into the sign of i) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d96a55858cbdf50f70a7440906ff67f8936c4f08;p=gcc.git re PR middle-end/77407 (Optimize integer i / abs (i) into the sign of i) 2016-10-04 Richard Biener PR middle-end/77407 * match.pd (X / abs (X) -> X < 0 ? -1 : 1): Drop vector type support, mark with :C. (X / -X -> -1): Mark with :C. From-SVN: r240742 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index efed569f605..d182496a509 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-10-04 Richard Biener + + PR middle-end/77407 + * match.pd (X / abs (X) -> X < 0 ? -1 : 1): Drop vector + type support, mark with :C. + (X / -X -> -1): Mark with :C. + 2016-10-04 Jakub Jelinek * defaults.h (JCR_SECTION_NAME, TARGET_USE_JCR_SECTION): Remove. diff --git a/gcc/match.pd b/gcc/match.pd index ba7e0132e31..dadf51cd205 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -155,14 +155,14 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (negate @0))) /* X / abs (X) is X < 0 ? -1 : 1. */ (simplify - (div @0 (abs @0)) - (if ((INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type)) + (div:C @0 (abs @0)) + (if (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_UNDEFINED (type)) (cond (lt @0 { build_zero_cst (type); }) { build_minus_one_cst (type); } { build_one_cst (type); }))) /* X / -X is -1. */ (simplify - (div @0 (negate @0)) + (div:C @0 (negate @0)) (if ((INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type)) && TYPE_OVERFLOW_UNDEFINED (type)) { build_minus_one_cst (type); })))