On Mon, 27 Aug 2018, Richard Biener wrote:

On Tue, Aug 21, 2018 at 7:20 PM MCC CS <mc...@gmx.com> wrote:

Hello all,

I have updated the testcase and run "make check" on Ubuntu x86_64.
All of them passed. (However the last part "do-check" couldn't be
run, probably due to a missing testsuite dependency?)

The match.pd is the same as the original patch, and I have
updated change-summaries and improved tests.

2018-08-21  MCC CS  <deswurs...@users.noreply.github.com>

        gcc/
        PR tree-optimization/87009
        * match.pd: Add boolean optimizations.

2018-08-21  MCC CS  <deswurs...@users.noreply.github.com>

        gcc/testsuite/
        PR tree-optimization/87009
        * gcc.dg/pr87009.c: New test.

Index: gcc/match.pd
===================================================================
--- gcc/match.pd        (revision 263646)
+++ gcc/match.pd        (working copy)
@@ -776,6 +776,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
  (bit_not (bit_and:cs (bit_not @0) @1))
  (bit_ior @0 (bit_not @1)))

+/* ~(~a | b)  -->  a & ~b  */
+(simplify
+ (bit_not (bit_ior:cs (bit_not @0) @1))
+ (bit_and @0 (bit_not @1)))
+
 /* Simplify (~X & Y) to X ^ Y if we know that (X & ~Y) is 0.  */
 #if GIMPLE
 (simplify
@@ -981,6 +986,16 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
  (bit_and:c (bit_ior:c @0 @1) (bit_xor:c @1 (bit_not @0)))
  (bit_and @0 @1))

+/* (~x | y) & (x | ~y) -> ~(x ^ y) */
+(simplify
+ (bit_and (bit_ior:c (bit_not @0) @1) (bit_ior:c @0 (bit_not @1)))

Please add single-use markers after the existing 'c' markers of the bit_ior's

+ (bit_not (bit_xor @0 @1)))
+
+/* (~x | y) ^ (x | ~y) -> x ^ y */
+(simplify
+ (bit_xor (bit_ior:c (bit_not @0) @1) (bit_ior:c @0 (bit_not @1)))
+ (bit_xor @0 @1))

Likewise.

Wouldn't :s be ignored here, since there is a single instruction in the output?

--
Marc Glisse

Reply via email to