PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / pr21643.c
blob8a721650aa3c565d3a997f78812dd0cdae725dd5
1 /* PR tree-optimization/21643 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-reassoc1-details" } */
4 /* { dg-additional-options "-mbranch-cost=2" { target branch_cost } } */
6 int
7 f1 (unsigned char c)
9 if (c == 0x22 || c == 0x20 || c < 0x20)
10 return 1;
11 return 0;
14 int
15 f2 (unsigned char c)
17 if (c == 0x22 || c <= 0x20)
18 return 1;
19 return 0;
22 int
23 f3 (unsigned char c)
25 if (c == 0x22)
26 return 1;
27 if (c == 0x20)
28 return 1;
29 if (c < 0x20)
30 return 1;
31 return 0;
34 int
35 f4 (unsigned char c)
37 if (c == 0x22 || c == 0x20 || c < 0x20)
38 return 2;
39 return 0;
42 int
43 f5 (unsigned char c)
45 if (c == 0x22 || c <= 0x20)
46 return 2;
47 return 0;
50 int
51 f6 (unsigned char c)
53 if (c == 0x22)
54 return 2;
55 if (c == 0x20)
56 return 2;
57 if (c < 0x20)
58 return 2;
59 return 0;
62 int
63 f7 (unsigned char c)
65 if (c != 0x22 && c != 0x20 && c >= 0x20)
66 return 0;
67 return 1;
70 int
71 f8 (unsigned char c)
73 if (c == 0x22 && c <= 0x20)
74 return 0;
75 return 1;
78 int
79 f9 (unsigned char c)
81 if (c == 0x22)
82 return 0;
83 if (c == 0x20)
84 return 0;
85 if (c < 0x20)
86 return 0;
87 return 1;
90 /* { dg-final { scan-tree-dump-times "Optimizing range tests c_\[0-9\]*.D. -.0, 31. and -.32, 32.\[\n\r\]* into" 6 "reassoc1" { target { ! logical_op_short_circuit } } } } */
91 /* { dg-final { scan-tree-dump-times "Optimizing range tests c_\[0-9\]*.D. -.0, 31. and -.32, 32.\[\n\r\]* into" 5 "reassoc1" { target logical_op_short_circuit } } } */