mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-25 19:04:52 +08:00
match.pd ((x & y) ^ (x | y) -> x ^ y): New pattern.
* match.pd ((x & y) ^ (x | y) -> x ^ y): New pattern. * gcc.dg/fold-xor-3.c: New test. From-SVN: r224370
This commit is contained in:
parent
6e28e5162a
commit
f13c4673a5
@ -1,3 +1,7 @@
|
||||
2015-06-11 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
* match.pd ((x & y) ^ (x | y) -> x ^ y): New pattern.
|
||||
|
||||
2015-06-11 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
* match.pd: Use single_use throughout.
|
||||
|
@ -320,6 +320,12 @@ along with GCC; see the file COPYING3. If not see
|
||||
(bitop:c (rbitop:c @0 @1) (bit_not@2 @0))
|
||||
(bitop @1 @2)))
|
||||
|
||||
/* (x & y) ^ (x | y) -> x ^ y */
|
||||
(simplify
|
||||
(bit_xor:c (bit_and@2 @0 @1) (bit_ior@3 @0 @1))
|
||||
(if (single_use (@2) && single_use (@3))
|
||||
(bit_xor @0 @1)))
|
||||
|
||||
(simplify
|
||||
(abs (negate @0))
|
||||
(abs @0))
|
||||
|
@ -1,3 +1,7 @@
|
||||
2015-06-11 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
* gcc.dg/fold-xor-3.c: New test.
|
||||
|
||||
2015-06-11 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
|
||||
|
||||
* gcc.target/arm/short-it-ifcvt-1.c: New test.
|
||||
|
37
gcc/testsuite/gcc.dg/fold-xor-3.c
Normal file
37
gcc/testsuite/gcc.dg/fold-xor-3.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O -fdump-tree-cddce1" } */
|
||||
|
||||
int
|
||||
fn1 (signed int x, signed int y)
|
||||
{
|
||||
signed int tem1 = x & y;
|
||||
signed int tem2 = x | y;
|
||||
return tem1 ^ tem2;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
fn2 (unsigned int x, unsigned int y)
|
||||
{
|
||||
unsigned int tem1 = x & y;
|
||||
unsigned int tem2 = x | y;
|
||||
return tem1 ^ tem2;
|
||||
}
|
||||
|
||||
int
|
||||
fn3 (signed int x, signed int y)
|
||||
{
|
||||
signed int tem1 = x & y;
|
||||
signed int tem2 = x | y;
|
||||
return tem2 ^ tem1;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
fn4 (unsigned int x, unsigned int y)
|
||||
{
|
||||
unsigned int tem1 = x & y;
|
||||
unsigned int tem2 = x | y;
|
||||
return tem2 ^ tem1;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-not " & " "cddce1" } } */
|
||||
/* { dg-final { scan-tree-dump-not " \\| " "cddce1" } } */
|
Loading…
Reference in New Issue
Block a user