1; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s
2
3define i64 @selectcceq(i64, i64, i64, i64) {
4; CHECK-LABEL: selectcceq:
5; CHECK:       # %bb.0:
6; CHECK-NEXT:    cmps.l %s0, %s0, %s1
7; CHECK-NEXT:    cmov.l.eq %s3, %s2, %s0
8; CHECK-NEXT:    or %s0, 0, %s3
9; CHECK-NEXT:    b.l.t (, %s10)
10  %5 = icmp eq i64 %0, %1
11  %6 = select i1 %5, i64 %2, i64 %3
12  ret i64 %6
13}
14
15define i64 @selectccne(i64, i64, i64, i64) {
16; CHECK-LABEL: selectccne:
17; CHECK:       # %bb.0:
18; CHECK-NEXT:    cmps.l %s0, %s0, %s1
19; CHECK-NEXT:    cmov.l.ne %s3, %s2, %s0
20; CHECK-NEXT:    or %s0, 0, %s3
21; CHECK-NEXT:    b.l.t (, %s10)
22  %5 = icmp ne i64 %0, %1
23  %6 = select i1 %5, i64 %2, i64 %3
24  ret i64 %6
25}
26
27define i64 @selectccsgt(i64, i64, i64, i64) {
28; CHECK-LABEL: selectccsgt:
29; CHECK:       # %bb.0:
30; CHECK-NEXT:    cmps.l %s0, %s0, %s1
31; CHECK-NEXT:    cmov.l.gt %s3, %s2, %s0
32; CHECK-NEXT:    or %s0, 0, %s3
33; CHECK-NEXT:    b.l.t (, %s10)
34  %5 = icmp sgt i64 %0, %1
35  %6 = select i1 %5, i64 %2, i64 %3
36  ret i64 %6
37}
38
39define i64 @selectccsge(i64, i64, i64, i64) {
40; CHECK-LABEL: selectccsge:
41; CHECK:       # %bb.0:
42; CHECK-NEXT:    cmps.l %s0, %s0, %s1
43; CHECK-NEXT:    cmov.l.ge %s3, %s2, %s0
44; CHECK-NEXT:    or %s0, 0, %s3
45; CHECK-NEXT:    b.l.t (, %s10)
46  %5 = icmp sge i64 %0, %1
47  %6 = select i1 %5, i64 %2, i64 %3
48  ret i64 %6
49}
50
51define i64 @selectccslt(i64, i64, i64, i64) {
52; CHECK-LABEL: selectccslt:
53; CHECK:       # %bb.0:
54; CHECK-NEXT:    cmps.l %s0, %s0, %s1
55; CHECK-NEXT:    cmov.l.lt %s3, %s2, %s0
56; CHECK-NEXT:    or %s0, 0, %s3
57; CHECK-NEXT:    b.l.t (, %s10)
58  %5 = icmp slt i64 %0, %1
59  %6 = select i1 %5, i64 %2, i64 %3
60  ret i64 %6
61}
62
63define i64 @selectccsle(i64, i64, i64, i64) {
64; CHECK-LABEL: selectccsle:
65; CHECK:       # %bb.0:
66; CHECK-NEXT:    cmps.l %s0, %s0, %s1
67; CHECK-NEXT:    cmov.l.le %s3, %s2, %s0
68; CHECK-NEXT:    or %s0, 0, %s3
69; CHECK-NEXT:    b.l.t (, %s10)
70  %5 = icmp sle i64 %0, %1
71  %6 = select i1 %5, i64 %2, i64 %3
72  ret i64 %6
73}
74
75define i64 @selectccugt(i64, i64, i64, i64) {
76; CHECK-LABEL: selectccugt:
77; CHECK:       # %bb.0:
78; CHECK-NEXT:    cmpu.l %s0, %s0, %s1
79; CHECK-NEXT:    cmov.l.gt %s3, %s2, %s0
80; CHECK-NEXT:    or %s0, 0, %s3
81; CHECK-NEXT:    b.l.t (, %s10)
82  %5 = icmp ugt i64 %0, %1
83  %6 = select i1 %5, i64 %2, i64 %3
84  ret i64 %6
85}
86
87define i64 @selectccuge(i64, i64, i64, i64) {
88; CHECK-LABEL: selectccuge:
89; CHECK:       # %bb.0:
90; CHECK-NEXT:    cmpu.l %s0, %s0, %s1
91; CHECK-NEXT:    cmov.l.ge %s3, %s2, %s0
92; CHECK-NEXT:    or %s0, 0, %s3
93; CHECK-NEXT:    b.l.t (, %s10)
94  %5 = icmp uge i64 %0, %1
95  %6 = select i1 %5, i64 %2, i64 %3
96  ret i64 %6
97}
98
99define i64 @selectccult(i64, i64, i64, i64) {
100; CHECK-LABEL: selectccult:
101; CHECK:       # %bb.0:
102; CHECK-NEXT:    cmpu.l %s0, %s0, %s1
103; CHECK-NEXT:    cmov.l.lt %s3, %s2, %s0
104; CHECK-NEXT:    or %s0, 0, %s3
105; CHECK-NEXT:    b.l.t (, %s10)
106  %5 = icmp ult i64 %0, %1
107  %6 = select i1 %5, i64 %2, i64 %3
108  ret i64 %6
109}
110
111define i64 @selectccule(i64, i64, i64, i64) {
112; CHECK-LABEL: selectccule:
113; CHECK:       # %bb.0:
114; CHECK-NEXT:    cmpu.l %s0, %s0, %s1
115; CHECK-NEXT:    cmov.l.le %s3, %s2, %s0
116; CHECK-NEXT:    or %s0, 0, %s3
117; CHECK-NEXT:    b.l.t (, %s10)
118  %5 = icmp ule i64 %0, %1
119  %6 = select i1 %5, i64 %2, i64 %3
120  ret i64 %6
121}
122
123define i64 @selectccugt2(i64, i64, i64, i64) {
124; CHECK-LABEL: selectccugt2:
125; CHECK:       # %bb.0:
126; CHECK-NEXT:    cmpu.l %s0, %s0, %s1
127; CHECK-NEXT:    cmov.l.gt %s3, %s2, %s0
128; CHECK-NEXT:    or %s0, 0, %s3
129; CHECK-NEXT:    b.l.t (, %s10)
130  %5 = icmp ugt i64 %0, %1
131  %6 = select i1 %5, i64 %2, i64 %3
132  ret i64 %6
133}
134
135define i64 @selectccuge2(i64, i64, i64, i64) {
136; CHECK-LABEL: selectccuge2:
137; CHECK:       # %bb.0:
138; CHECK-NEXT:    cmpu.l %s0, %s0, %s1
139; CHECK-NEXT:    cmov.l.ge %s3, %s2, %s0
140; CHECK-NEXT:    or %s0, 0, %s3
141; CHECK-NEXT:    b.l.t (, %s10)
142  %5 = icmp uge i64 %0, %1
143  %6 = select i1 %5, i64 %2, i64 %3
144  ret i64 %6
145}
146
147define i64 @selectccult2(i64, i64, i64, i64) {
148; CHECK-LABEL: selectccult2:
149; CHECK:       # %bb.0:
150; CHECK-NEXT:    cmpu.l %s0, %s0, %s1
151; CHECK-NEXT:    cmov.l.lt %s3, %s2, %s0
152; CHECK-NEXT:    or %s0, 0, %s3
153; CHECK-NEXT:    b.l.t (, %s10)
154  %5 = icmp ult i64 %0, %1
155  %6 = select i1 %5, i64 %2, i64 %3
156  ret i64 %6
157}
158
159define i64 @selectccule2(i64, i64, i64, i64) {
160; CHECK-LABEL: selectccule2:
161; CHECK:       # %bb.0:
162; CHECK-NEXT:    cmpu.l %s0, %s0, %s1
163; CHECK-NEXT:    cmov.l.le %s3, %s2, %s0
164; CHECK-NEXT:    or %s0, 0, %s3
165; CHECK-NEXT:    b.l.t (, %s10)
166  %5 = icmp ule i64 %0, %1
167  %6 = select i1 %5, i64 %2, i64 %3
168  ret i64 %6
169}
170