public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Adjust some patterns wrt :c
@ 2015-10-26 13:29 Richard Biener
  2015-10-26 16:51 ` Marc Glisse
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2015-10-26 13:29 UTC (permalink / raw)
  To: gcc-patches


This removes the genmatch warnings.

Bootstrapped / tested on x86_64-unknown-linux-gnu, applied.

Richard.

2015-10-26  Richard Biener  <rguenther@suse.de>

	* match.pd ((A & ~B) - (A & B) -> (A ^ B) - B): Add missing :c.
	( (X & ~Y) | (~X & Y) -> X ^ Y): Remove redundant :c.

Index: gcc/match.pd
===================================================================
--- gcc/match.pd	(revision 229307)
+++ gcc/match.pd	(working copy)
@@ -435,7 +435,7 @@ (define_operator_list RINT BUILT_IN_RINT
 
 /* Fold (A & ~B) - (A & B) into (A ^ B) - B.  */
 (simplify
- (minus (bit_and:cs @0 (bit_not @1)) (bit_and:s @0 @1))
+ (minus (bit_and:cs @0 (bit_not @1)) (bit_and:cs @0 @1))
   (minus (bit_xor @0 @1) @1))
 (simplify
  (minus (bit_and:s @0 INTEGER_CST@2) (bit_and:s @0 INTEGER_CST@1))
@@ -449,7 +449,7 @@ (define_operator_list RINT BUILT_IN_RINT
 
 /* Simplify (X & ~Y) | (~X & Y) -> X ^ Y.  */
 (simplify
- (bit_ior:c (bit_and:c @0 (bit_not @1)) (bit_and:c (bit_not @0) @1))
+ (bit_ior (bit_and:c @0 (bit_not @1)) (bit_and:c (bit_not @0) @1))
   (bit_xor @0 @1))
 (simplify
  (bit_ior:c (bit_and @0 INTEGER_CST@2) (bit_and (bit_not @0) INTEGER_CST@1))

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Adjust some patterns wrt :c
  2015-10-26 13:29 [PATCH] Adjust some patterns wrt :c Richard Biener
@ 2015-10-26 16:51 ` Marc Glisse
  2015-10-27 12:08   ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Glisse @ 2015-10-26 16:51 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

On Mon, 26 Oct 2015, Richard Biener wrote:

> @@ -435,7 +435,7 @@ (define_operator_list RINT BUILT_IN_RINT
>
> /* Fold (A & ~B) - (A & B) into (A ^ B) - B.  */
> (simplify
> - (minus (bit_and:cs @0 (bit_not @1)) (bit_and:s @0 @1))
> + (minus (bit_and:cs @0 (bit_not @1)) (bit_and:cs @0 @1))
>   (minus (bit_xor @0 @1) @1))

Sorry, I should have listed them all, but the same applies to
/* Fold (A & B) - (A & ~B) into B - (A ^ B).  */
a few lines below.

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Adjust some patterns wrt :c
  2015-10-26 16:51 ` Marc Glisse
@ 2015-10-27 12:08   ` Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2015-10-27 12:08 UTC (permalink / raw)
  To: gcc-patches

On Mon, 26 Oct 2015, Marc Glisse wrote:

> On Mon, 26 Oct 2015, Richard Biener wrote:
> 
> > @@ -435,7 +435,7 @@ (define_operator_list RINT BUILT_IN_RINT
> > 
> > /* Fold (A & ~B) - (A & B) into (A ^ B) - B.  */
> > (simplify
> > - (minus (bit_and:cs @0 (bit_not @1)) (bit_and:s @0 @1))
> > + (minus (bit_and:cs @0 (bit_not @1)) (bit_and:cs @0 @1))
> >   (minus (bit_xor @0 @1) @1))
> 
> Sorry, I should have listed them all, but the same applies to
> /* Fold (A & B) - (A & ~B) into B - (A ^ B).  */
> a few lines below.

Heh.  I wonder if we can teach genmatch to auto-annotate commutative
operands (detecting the cases where it doesn't get us anything but
redundant patterns).  Or implement a warning that catches them at
least.

Anyway, fixed in my local tree, will go out with my next match.pd
modification.

Richard.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-27 12:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-26 13:29 [PATCH] Adjust some patterns wrt :c Richard Biener
2015-10-26 16:51 ` Marc Glisse
2015-10-27 12:08   ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).