Debian Codegraph @

gcc/testsuite/gcc.dg/fold-ior-4.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3 /* { dg-require-effective-target int32plus } */
4
5 unsigned int test_ior(unsigned char i)
6 {
7 return i | (i<<8) | (i<<16) | (i<<24);
8 }
9
10 unsigned int test_xor(unsigned char i)
11 {
12 return i ^ (i<<8) ^ (i<<16) ^ (i<<24);
13 }
14
15 unsigned int test_ior_1s(unsigned char i)
16 {
17 return i | (i<<8);
18 }
19
20 unsigned int test_ior_1u(unsigned char i)
21 {
22 unsigned int t = i;
23 return t | (t<<8);
24 }
25
26 unsigned int test_xor_1s(unsigned char i)
27 {
28 return i ^ (i<<8);
29 }
30
31 unsigned int test_xor_1u(unsigned char i)
32 {
33 unsigned int t = i;
34 return t ^ (t<<8);
35 }
36
37 unsigned int test_ior_2s(unsigned char i)
38 {
39 return (i<<8) | (i<<16);
40 }
41
42 unsigned int test_ior_2u(unsigned char i)
43 {
44 unsigned int t = i;
45 return (t<<8) | (t<<16);
46 }
47
48 unsigned int test_xor_2s(unsigned char i)
49 {
50 return (i<<8) ^ (i<<16);
51 }
52
53 unsigned int test_xor_2u(unsigned char i)
54 {
55 unsigned int t = i;
56 return (t<<8) ^ (t<<16);
57 }
58
59 /* { dg-final { scan-tree-dump-not " \\^ " "optimized" } } */
60 /* { dg-final { scan-tree-dump-not " \\| " "optimized" } } */
61 /* { dg-final { scan-tree-dump-times " \\* 16843009" 2 "optimized" } } */
62