1 /* { dg-do compile { target { ilp32 || lp64 } } } */
2 /* { dg-options "-O2 -fno-ipa-icf -fdump-tree-optimized" } */
3
4 /* All four functions should be folded to:
5
6 (sizetype) (a + 15 - b) < 30. */
7
8 _Bool
f1(char * a,char * b)9 f1 (char *a, char *b)
10 {
11 return (a + 16 <= b) || (b + 16 <= a);
12 }
13
14 _Bool
f2(char * a,char * b)15 f2 (char *a, char *b)
16 {
17 return (a + 15 < b) || (b + 15 < a);
18 }
19
20 _Bool
f3(char * a,char * b)21 f3 (char *a, char *b)
22 {
23 return (a + 16 <= b) | (b + 16 <= a);
24 }
25
26 _Bool
f4(char * a,char * b)27 f4 (char *a, char *b)
28 {
29 return (a + 15 < b) | (b + 15 < a);
30 }
31
32 /* { dg-final { scan-tree-dump-times { = [^\n]* - [^\n]*;} 4 "optimized" } } */
33 /* { dg-final { scan-tree-dump-times { = [^\n]* \+ [^\n]*;} 4 "optimized" } } */
34 /* { dg-final { scan-tree-dump-times { = [^\n]*\ > [^\n]*;} 4 "optimized" } } */
35 /* { dg-final { scan-tree-dump-not {=[^\n]*\ < [^\n]*;} "optimized" } } */
36 /* { dg-final { scan-tree-dump-times { \+ 15} 4 "optimized" } } */
37 /* { dg-final { scan-tree-dump-times { > 30} 4 "optimized" } } */
38