[PATCH][match-and-simplify]
Richard Biener
rguenther@suse.de
Tue Jun 3 08:37:00 GMT 2014
On Mon, 2 Jun 2014, Marc Glisse wrote:
>
> > (plus (bit_not @0) @0)
> > if (INTEGRAL_TYPE_P (TREE_TYPE (@0)))
> > { build_int_cst (TREE_TYPE (@0), -1); })
> > +(match_and_simplify
> > + (plus @0 (bit_not @0))
> > + if (INTEGRAL_TYPE_P (TREE_TYPE (@0)))
> > + { build_int_cst (TREE_TYPE (@0), -1); })
>
> Why not just:
>
> (match_and_simplify
> (plus @0 (bit_not @0))
> { build_all_ones_cst (TREE_TYPE (@0)); })
>
> ? Works for vector/complex, I don't know what type a bit_not_expr can have
> where the simplification wouldn't be true.
Sure.
Richard.
2014-06-03 Richard Biener <rguenther@suse.de>
* match.pd: Generalize ~A + A -> -1 simplification to all
types.
Index: gcc/match.pd
===================================================================
--- gcc/match.pd (revision 211135)
+++ gcc/match.pd (working copy)
@@ -185,12 +185,10 @@ to (minus @1 @0)
/* ~A + A -> -1 */
(match_and_simplify
(plus (bit_not @0) @0)
- if (INTEGRAL_TYPE_P (TREE_TYPE (@0)))
- { build_int_cst (TREE_TYPE (@0), -1); })
+ { build_all_ones_cst (type); })
(match_and_simplify
(plus @0 (bit_not @0))
- if (INTEGRAL_TYPE_P (TREE_TYPE (@0)))
- { build_int_cst (TREE_TYPE (@0), -1); })
+ { build_all_ones_cst (type); })
/* ~A + 1 -> -A */
(match_and_simplify
More information about the Gcc-patches
mailing list