gcc/gcc/testsuite/gcc.dg/fold-xor-4.c
Marek Polacek 9ea65ca688 match.pd ((x ^ y) ^ (x | y) -> x & y, (x & y) + (x ^ y) -> x | y, (x & y) | (x ^ y) -> x | y, (x & y) ^ (x ^ y) -> x | y, (x & y) + (x | y) -> x + y, (x | y) - (x ^ y) -> x & y, (x | y) - (x & y) -> x ^ y): New patterns.
* match.pd ((x ^ y) ^ (x | y) -> x & y,
	(x & y) + (x ^ y) -> x | y, (x & y) | (x ^ y) -> x | y,
	(x & y) ^ (x ^ y) -> x | y, (x & y) + (x | y) -> x + y,
	(x | y) - (x ^ y) -> x & y, (x | y) - (x & y) -> x ^ y): New patterns.

	* gcc.dg/fold-ior-1.c: New test.
	* gcc.dg/fold-minus-2.c: New test.
	* gcc.dg/fold-minus-3.c: New test.
	* gcc.dg/fold-plus-1.c: New test.
	* gcc.dg/fold-plus-2.c: New test.
	* gcc.dg/fold-xor-4.c: New test.
	* gcc.dg/fold-xor-5.c: New test.

From-SVN: r224734
2015-06-22 14:46:14 +00:00

70 lines
906 B
C

/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-cddce1" } */
int
fn1 (int a, int b)
{
int tem1 = a & b;
int tem2 = a ^ b;
return tem1 ^ tem2;
}
int
fn2 (int a, int b)
{
int tem1 = b & a;
int tem2 = a ^ b;
return tem1 ^ tem2;
}
int
fn3 (int a, int b)
{
int tem1 = a & b;
int tem2 = b ^ a;
return tem1 ^ tem2;
}
int
fn4 (int a, int b)
{
int tem1 = b & a;
int tem2 = b ^ a;
return tem1 ^ tem2;
}
int
fn5 (int a, int b)
{
int tem1 = a ^ b;
int tem2 = a & b;
return tem1 ^ tem2;
}
int
fn6 (int a, int b)
{
int tem1 = b ^ a;
int tem2 = a & b;
return tem1 ^ tem2;
}
int
fn7 (int a, int b)
{
int tem1 = a ^ b;
int tem2 = b & a;
return tem1 ^ tem2;
}
int
fn8 (int a, int b)
{
int tem1 = b ^ a;
int tem2 = b & a;
return tem1 ^ tem2;
}
/* { dg-final { scan-tree-dump-not " & " "cddce1" } } */
/* { dg-final { scan-tree-dump-not " \\^ " "cddce1" } } */