2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / fold-cond-2.c
blob68ec75480ada80e2314db4e2239a67c3e6798634
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 int
5 min1 (signed char op1, signed char op2)
7 return (op1 < 25) ? (int)op1 : 24;
9 int
10 min2 (signed char op1, signed char op2)
12 return (op1 <= 24) ? (int)op1 : 25;
14 int
15 min3 (unsigned char op1, unsigned char op2)
17 return (op1 < 25) ? (unsigned int)op1 : 24;
19 int
20 min4 (unsigned char op1, unsigned char op2)
22 return (op1 <= 24) ? (unsigned int)op1 : 25;
24 int
25 max1 (signed char op1, signed char op2)
27 return (op1 > 24) ? (int)op1 : 25;
29 int
30 max2 (signed char op1, signed char op2)
32 return (op1 >= 25) ? (int)op1 : 24;
34 int
35 max3 (unsigned char op1, unsigned char op2)
37 return (op1 > 24) ? (unsigned int)op1 : 25;
39 int
40 max4 (unsigned char op1, unsigned char op2)
42 return (op1 >= 25) ? (unsigned int)op1 : 24;
45 /* { dg-final { scan-tree-dump-times "MIN_EXPR" 4 "optimized" } } */
46 /* { dg-final { scan-tree-dump-times "MAX_EXPR" 4 "optimized" } } */