~X & Y to X ^ Y in some cases
2016-05-17 Marc Glisse <marc.glisse@inria.fr> gcc/ * match.pd (~X & Y): New transformation. gcc/testsuite/ * gcc.dg/tree-ssa/pr69270.c: Adjust. * gcc.dg/tree-ssa/andnot-1.c: New testcase. From-SVN: r236337
This commit is contained in:
parent
0139ba9332
commit
d982c5b7b7
@ -1,3 +1,7 @@
|
||||
2016-05-17 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
* match.pd (~X & Y): New transformation.
|
||||
|
||||
2016-05-17 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
* tree-vrp.c (simplify_truth_ops_using_ranges): Set range
|
||||
|
@ -503,6 +503,14 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
|
||||
(bit_ior:c (bit_and @0 INTEGER_CST@2) (bit_and (bit_not @0) INTEGER_CST@1))
|
||||
(if (wi::bit_not (@2) == @1)
|
||||
(bit_xor @0 @1)))
|
||||
/* Simplify (~X & Y) to X ^ Y if we know that (X & ~Y) is 0. */
|
||||
#if GIMPLE
|
||||
(simplify
|
||||
(bit_and (bit_not SSA_NAME@0) INTEGER_CST@1)
|
||||
(if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
|
||||
&& (get_nonzero_bits (@0) & wi::bit_not (@1)) == 0)
|
||||
(bit_xor @0 @1)))
|
||||
#endif
|
||||
|
||||
/* X % Y is smaller than Y. */
|
||||
(for cmp (lt ge)
|
||||
|
@ -1,3 +1,8 @@
|
||||
2016-05-17 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
* gcc.dg/tree-ssa/pr69270.c: Adjust.
|
||||
* gcc.dg/tree-ssa/andnot-1.c: New testcase.
|
||||
|
||||
2016-05-17 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
* gcc.dg/tree-ssa/pr69270.c: Adjust.
|
||||
|
12
gcc/testsuite/gcc.dg/tree-ssa/andnot-1.c
Normal file
12
gcc/testsuite/gcc.dg/tree-ssa/andnot-1.c
Normal file
@ -0,0 +1,12 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O -fdump-tree-optimized-raw" } */
|
||||
|
||||
unsigned f(unsigned i){
|
||||
i >>= __SIZEOF_INT__ * __CHAR_BIT__ - 3;
|
||||
i = ~i;
|
||||
return i & 7;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump "bit_xor_expr" "optimized" } } */
|
||||
/* { dg-final { scan-tree-dump-not "bit_not_expr" "optimized" } } */
|
||||
/* { dg-final { scan-tree-dump-not "bit_and_expr" "optimized" } } */
|
Loading…
Reference in New Issue
Block a user