1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3
4 int
cmp_si_test1(int a,int b,int c)5 cmp_si_test1 (int a, int b, int c)
6 {
7 if (a > b)
8 return a + c;
9 else
10 return a + b + c;
11 }
12
13 int
cmp_si_test2(int a,int b,int c)14 cmp_si_test2 (int a, int b, int c)
15 {
16 if ((a >> 3) > b)
17 return a + c;
18 else
19 return a + b + c;
20 }
21
22 typedef long long s64;
23
24 s64
cmp_di_test1(s64 a,s64 b,s64 c)25 cmp_di_test1 (s64 a, s64 b, s64 c)
26 {
27 if (a > b)
28 return a + c;
29 else
30 return a + b + c;
31 }
32
33 s64
cmp_di_test2(s64 a,s64 b,s64 c)34 cmp_di_test2 (s64 a, s64 b, s64 c)
35 {
36 if ((a >> 3) > b)
37 return a + c;
38 else
39 return a + b + c;
40 }
41
42 int
cmp_di_test3(int a,s64 b,s64 c)43 cmp_di_test3 (int a, s64 b, s64 c)
44 {
45 if (a > b)
46 return a + c;
47 else
48 return a + b + c;
49 }
50
51 int
cmp_di_test4(int a,s64 b,s64 c)52 cmp_di_test4 (int a, s64 b, s64 c)
53 {
54 if (((s64)a << 3) > b)
55 return a + c;
56 else
57 return a + b + c;
58 }
59
60 /* { dg-final { scan-assembler-times "cmp\tw\[0-9\]+, w\[0-9\]+" 2 } } */
61 /* { dg-final { scan-assembler-times "cmp\tx\[0-9\]+, x\[0-9\]+" 2 } } */
62 /* { dg-final { scan-assembler-times "cmp\tx\[0-9\]+, w\[0-9\]+, sxtw" 2 } } */
63