Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/bitops-5.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized-raw" } */
3 /* PR tree-optimization/111679 */
4
5 int f1(int a, int b)
6 {
7 return (~a) | (a ^ b); // ~(a & b) or (~a) | (~b)
8 }
9
10 _Bool fb(_Bool c, _Bool d)
11 {
12 return (!c) | (c ^ d); // ~(c & d) or (~c) | (~d)
13 }
14
15 _Bool fb1(int x, int y)
16 {
17 _Bool a = x == 10, b = y > 100;
18 return (!a) | (a ^ b); // ~(a & b) or (~a) | (~b)
19 // or (x != 10) | (y <= 100)
20 }
21
22 /* { dg-final { scan-tree-dump-not "bit_xor_expr, " "optimized" } } */
23 /* { dg-final { scan-tree-dump-times "bit_not_expr, " 2 "optimized" } } */
24 /* { dg-final { scan-tree-dump-times "bit_and_expr, " 2 "optimized" } } */
25 /* { dg-final { scan-tree-dump-times "bit_ior_expr, " 1 "optimized" } } */
26 /* { dg-final { scan-tree-dump-times "ne_expr, _\[0-9\]+, x_\[0-9\]+" 1 "optimized" } } */
27 /* { dg-final { scan-tree-dump-times "le_expr, _\[0-9\]+, y_\[0-9\]+" 1 "optimized" } } */