re PR middle-end/63568 (Missed optimization (a & ~mask) | (b & mask) = a ^ ((a ^ b) & mask))
PR middle-end/63568 * match.pd: Add (x & ~m) | (y & m) -> ((x ^ y) & m) ^ x pattern. * gcc.dg/pr63568.c: New test. From-SVN: r218816
This commit is contained in:
parent
4c57980f9d
commit
f52baa7b6e
|
@ -1,3 +1,8 @@
|
|||
2014-12-17 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR middle-end/63568
|
||||
* match.pd: Add (x & ~m) | (y & m) -> ((x ^ y) & m) ^ x pattern.
|
||||
|
||||
2014-12-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/64322
|
||||
|
|
|
@ -382,6 +382,13 @@ along with GCC; see the file COPYING3. If not see
|
|||
(bit_not (bit_not @0))
|
||||
@0)
|
||||
|
||||
/* (x & ~m) | (y & m) -> ((x ^ y) & m) ^ x */
|
||||
(simplify
|
||||
(bit_ior:c (bit_and:c@3 @0 (bit_not @2)) (bit_and:c@4 @1 @2))
|
||||
(if ((TREE_CODE (@3) != SSA_NAME || has_single_use (@3))
|
||||
&& (TREE_CODE (@4) != SSA_NAME || has_single_use (@4)))
|
||||
(bit_xor (bit_and (bit_xor @0 @1) @2) @0)))
|
||||
|
||||
|
||||
/* Associate (p +p off1) +p off2 as (p +p (off1 + off2)). */
|
||||
(simplify
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2014-12-17 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR middle-end/63568
|
||||
* gcc.dg/pr63568.c: New test.
|
||||
|
||||
2014-12-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/64322
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* PR middle-end/63568 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-fdump-tree-original" } */
|
||||
|
||||
int
|
||||
fn1 (int a, int b, int m)
|
||||
{
|
||||
return (a & ~m) | (b & m);
|
||||
}
|
||||
|
||||
int
|
||||
fn2 (int a, int b, int m)
|
||||
{
|
||||
return (a & ~m) | (m & b);
|
||||
}
|
||||
|
||||
int
|
||||
fn3 (int a, int b, int m)
|
||||
{
|
||||
return (~m & a) | (m & b);
|
||||
}
|
||||
|
||||
int
|
||||
fn4 (int a, int b, int m)
|
||||
{
|
||||
return (~m & a) | (b & m);
|
||||
}
|
||||
|
||||
int
|
||||
fn5 (int a, int b, int m)
|
||||
{
|
||||
return (b & m) | (a & ~m);
|
||||
}
|
||||
|
||||
int
|
||||
fn6 (int a, int b, int m)
|
||||
{
|
||||
return (m & b) | (a & ~m);
|
||||
}
|
||||
|
||||
int
|
||||
fn7 (int a, int b, int m)
|
||||
{
|
||||
return (m & b) | (~m & a);
|
||||
}
|
||||
|
||||
int
|
||||
fn8 (int a, int b, int m)
|
||||
{
|
||||
return (b & m) | (~m & a);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-not " \\| " "original" } } */
|
||||
/* { dg-final { cleanup-tree-dump "original" } } */
|
Loading…
Reference in New Issue