On Fri, 24 Oct 2014, Jakub Jelinek wrote:

> On Fri, Oct 24, 2014 at 03:27:19PM +0200, Richard Biener wrote:
> > As noted by Marc I forgot to actually utilize the iterator variable.
> > 
> > Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
> > 
> > Richard.
> > 
> > PS: How do we want to refer to patterns in ChangeLogs?
> 
> Perhaps the syntax should be (simplify "name" (...) { ... })
> (maybe the name being optional?), where you'd give some name to the
> simplification, say "0 % X" or "0 % X => 0" or "0 % X variant 3"
> or whatever, then you could easily refer to those strings in ChangeLog,
> on gcc-patches, in comments etc.

I ripped out optional name support when I added user-defined predicates
which look like

(match truth_valued_p
  (truth_not @0))

or

(match (logical_inverted_value @0)
 (bit_not truth_valued_p@0))

(un-)conveniently the parsers for (simplify...) and (match...)
are shared.

I can see to re-add the optional pattern naming.  OTOH it will be
fun to invent an unique name for each of them ;)  (patternN
anyone? ...)

Richard.

> > 2014-10-24  Richard Biener  <rguent...@suse.de>
> > 
> >     * match.pd (0 % X): Properly use the iterator iterating over
> >     all modulo operators.
> >     (X % 1): Likewise.
> > 
> > Index: gcc/match.pd
> > ===================================================================
> > --- gcc/match.pd    (revision 216648)
> > +++ gcc/match.pd    (working copy)
> > @@ -64,13 +64,13 @@ (define_predicates
> >  (for op (ceil_mod floor_mod round_mod trunc_mod)
> >   /* 0 % X is always zero.  */
> >   (simplify
> > -  (trunc_mod integer_zerop@0 @1)
> > +  (op integer_zerop@0 @1)
> >    /* But not for 0 % 0 so that we can get the proper warnings and errors.  
> > */
> >    (if (!integer_zerop (@1))
> >     @0))
> >   /* X % 1 is always zero.  */
> >   (simplify
> > -  (trunc_mod @0 integer_onep)
> > +  (op @0 integer_onep)
> >    { build_zero_cst (type); }))
> >  
> >  /* x | ~0 -> ~0  */

Reply via email to