1; RUN: llc -O2 -march=bpfel -mattr=+alu32 < %s | FileCheck %s
2;
3; unsigned int select_cc_32 (unsigned a, unsigned b, int c, int d)
4; {
5;   if (a > b)
6;     return c;
7;   else
8;     return d;
9; }
10;
11; long long select_cc_32_64 (unsigned a, unsigned b, long long c, long long d)
12; {
13;   if (a > b)
14;     return c;
15;   else
16;     return d;
17; }
18;
19; int select_cc_64_32 (long long a, long long b, int c, int d)
20; {
21;   if (a > b)
22;     return c;
23;   else
24;     return d;
25; }
26;
27; int selecti_cc_32 (unsigned a, int c, int d)
28; {
29;   if (a > 10)
30;     return c;
31;   else
32;     return d;
33; }
34;
35; long long selecti_cc_32_64 (unsigned a, long long c, long long d)
36; {
37;   if (a > 11)
38;     return c;
39;   else
40;     return d;
41; }
42;
43; int selecti_cc_64_32 (long long a, int c, int d)
44; {
45;   if (a > 12)
46;     return c;
47;   else
48;     return d;
49; }
50
51; Function Attrs: norecurse nounwind readnone
52define dso_local i32 @select_cc_32(i32 %a, i32 %b, i32 %c, i32 %d) local_unnamed_addr #0 {
53entry:
54  %cmp = icmp ugt i32 %a, %b
55  %c.d = select i1 %cmp, i32 %c, i32 %d
56  ret i32 %c.d
57}
58
59; Function Attrs: norecurse nounwind readnone
60define dso_local i64 @select_cc_32_64(i32 %a, i32 %b, i64 %c, i64 %d) local_unnamed_addr #0 {
61entry:
62  %cmp = icmp ugt i32 %a, %b
63  %c.d = select i1 %cmp, i64 %c, i64 %d
64  ret i64 %c.d
65}
66
67; Function Attrs: norecurse nounwind readnone
68define dso_local i32 @select_cc_64_32(i64 %a, i64 %b, i32 %c, i32 %d) local_unnamed_addr #0 {
69entry:
70  %cmp = icmp sgt i64 %a, %b
71  %c.d = select i1 %cmp, i32 %c, i32 %d
72  ret i32 %c.d
73}
74
75; Function Attrs: norecurse nounwind readnone
76define dso_local i32 @selecti_cc_32(i32 %a, i32 %c, i32 %d) local_unnamed_addr #0 {
77entry:
78  %cmp = icmp ugt i32 %a, 10
79  %c.d = select i1 %cmp, i32 %c, i32 %d
80  ret i32 %c.d
81}
82
83; Function Attrs: norecurse nounwind readnone
84define dso_local i64 @selecti_cc_32_64(i32 %a, i64 %c, i64 %d) local_unnamed_addr #0 {
85entry:
86  %cmp = icmp ugt i32 %a, 11
87  %c.d = select i1 %cmp, i64 %c, i64 %d
88  ret i64 %c.d
89}
90
91; Function Attrs: norecurse nounwind readnone
92define dso_local i32 @selecti_cc_64_32(i64 %a, i32 %c, i32 %d) local_unnamed_addr #0 {
93entry:
94  %cmp = icmp sgt i64 %a, 12
95  %c.d = select i1 %cmp, i32 %c, i32 %d
96  ret i32 %c.d
97}
98; There shouldn't be any type promotion, all of them are expected to be
99; eliminated by peephole optimization.
100; CHECK-NOT: r{{[0-9]+}} <<= 32
101