re PR tree-optimization/52267 (a&~N where N has all the bits set up till a specific...
[gcc.git] / gcc / testsuite / gcc.dg / pr52267.c
1 /* PR tree-optimization/52267 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
4
5 int
6 foo (int a, int b)
7 {
8 if (a > 3 || a < 0)
9 return a;
10 a &= 3;
11 return a & 3;
12 }
13
14 int
15 bar (int a)
16 {
17 if (a & ~3)
18 return a;
19 return a & 3;
20 }
21
22 /* { dg-final { scan-tree-dump-not "& 3" "optimized" } } */
23 /* { dg-final { scan-tree-dump-not "& -4" "optimized" } } */
24 /* { dg-final { cleanup-tree-dump "optimized" } } */