diff options
Diffstat (limited to 'gcc/match.pd')
-rw-r--r-- | gcc/match.pd | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index 68201ff..43bacb4 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -3812,6 +3812,16 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (cnd (logical_inverted_value truth_valued_p@0) @1 @2) (cnd @0 @2 @1))) +/* -(type)!A -> (type)A - 1. */ +(simplify + (negate (convert?:s (logical_inverted_value:s @0))) + (if (INTEGRAL_TYPE_P (type) + && TREE_CODE (type) != BOOLEAN_TYPE + && TYPE_PRECISION (type) > 1 + && TREE_CODE (@0) == SSA_NAME + && ssa_name_has_boolean_range (@0)) + (plus (convert:type @0) { build_all_ones_cst (type); }))) + /* A + (B vcmp C ? 1 : 0) -> A - (B vcmp C ? -1 : 0), since vector comparisons return all -1 or all 0 results. */ /* ??? We could instead convert all instances of the vec_cond to negate, |