1; RUN: llc < %s -mtriple=armv8-linux-gnueabihf -mattr=+fp-armv8 -float-abi=hard | FileCheck %s
2@varfloat = global float 0.0
3@vardouble = global double 0.0
4define void @test_vsel32sgt(i32 %lhs32, i32 %rhs32, float %a, float %b) {
5; CHECK: test_vsel32sgt
6  %tst1 = icmp sgt i32 %lhs32, %rhs32
7  %val1 = select i1 %tst1, float %a, float %b
8  store float %val1, float* @varfloat
9; CHECK: cmp r0, r1
10; CHECK: vselgt.f32 s0, s0, s1
11  ret void
12}
13define void @test_vsel64sgt(i32 %lhs32, i32 %rhs32, double %a, double %b) {
14; CHECK: test_vsel64sgt
15  %tst1 = icmp sgt i32 %lhs32, %rhs32
16  %val1 = select i1 %tst1, double %a, double %b
17  store double %val1, double* @vardouble
18; CHECK: cmp r0, r1
19; CHECK: vselgt.f64 d16, d0, d1
20  ret void
21}
22define void @test_vsel32sge(i32 %lhs32, i32 %rhs32, float %a, float %b) {
23; CHECK: test_vsel32sge
24  %tst1 = icmp sge i32 %lhs32, %rhs32
25  %val1 = select i1 %tst1, float %a, float %b
26  store float %val1, float* @varfloat
27; CHECK: cmp r0, r1
28; CHECK: vselge.f32 s0, s0, s1
29  ret void
30}
31define void @test_vsel64sge(i32 %lhs32, i32 %rhs32, double %a, double %b) {
32; CHECK: test_vsel64sge
33  %tst1 = icmp sge i32 %lhs32, %rhs32
34  %val1 = select i1 %tst1, double %a, double %b
35  store double %val1, double* @vardouble
36; CHECK: cmp r0, r1
37; CHECK: vselge.f64 d16, d0, d1
38  ret void
39}
40define void @test_vsel32eq(i32 %lhs32, i32 %rhs32, float %a, float %b) {
41; CHECK: test_vsel32eq
42  %tst1 = icmp eq i32 %lhs32, %rhs32
43  %val1 = select i1 %tst1, float %a, float %b
44  store float %val1, float* @varfloat
45; CHECK: cmp r0, r1
46; CHECK: vseleq.f32 s0, s0, s1
47  ret void
48}
49define void @test_vsel64eq(i32 %lhs32, i32 %rhs32, double %a, double %b) {
50; CHECK: test_vsel64eq
51  %tst1 = icmp eq i32 %lhs32, %rhs32
52  %val1 = select i1 %tst1, double %a, double %b
53  store double %val1, double* @vardouble
54; CHECK: cmp r0, r1
55; CHECK: vseleq.f64 d16, d0, d1
56  ret void
57}
58define void @test_vsel32slt(i32 %lhs32, i32 %rhs32, float %a, float %b) {
59; CHECK: test_vsel32slt
60  %tst1 = icmp slt i32 %lhs32, %rhs32
61  %val1 = select i1 %tst1, float %a, float %b
62  store float %val1, float* @varfloat
63; CHECK: cmp r0, r1
64; CHECK: vselge.f32 s0, s1, s0
65  ret void
66}
67define void @test_vsel64slt(i32 %lhs32, i32 %rhs32, double %a, double %b) {
68; CHECK: test_vsel64slt
69  %tst1 = icmp slt i32 %lhs32, %rhs32
70  %val1 = select i1 %tst1, double %a, double %b
71  store double %val1, double* @vardouble
72; CHECK: cmp r0, r1
73; CHECK: vselge.f64 d16, d1, d0
74  ret void
75}
76define void @test_vsel32sle(i32 %lhs32, i32 %rhs32, float %a, float %b) {
77; CHECK: test_vsel32sle
78  %tst1 = icmp sle i32 %lhs32, %rhs32
79  %val1 = select i1 %tst1, float %a, float %b
80  store float %val1, float* @varfloat
81; CHECK: cmp r0, r1
82; CHECK: vselgt.f32 s0, s1, s0
83  ret void
84}
85define void @test_vsel64sle(i32 %lhs32, i32 %rhs32, double %a, double %b) {
86; CHECK: test_vsel64sle
87  %tst1 = icmp sle i32 %lhs32, %rhs32
88  %val1 = select i1 %tst1, double %a, double %b
89  store double %val1, double* @vardouble
90; CHECK: cmp r0, r1
91; CHECK: vselgt.f64 d16, d1, d0
92  ret void
93}
94define void @test_vsel32ogt(float %lhs32, float %rhs32, float %a, float %b) {
95; CHECK: test_vsel32ogt
96  %tst1 = fcmp ogt float %lhs32, %rhs32
97  %val1 = select i1 %tst1, float %a, float %b
98  store float %val1, float* @varfloat
99; CHECK: vcmpe.f32 s0, s1
100; CHECK: vselgt.f32 s0, s2, s3
101  ret void
102}
103define void @test_vsel64ogt(float %lhs32, float %rhs32, double %a, double %b) {
104; CHECK: test_vsel64ogt
105  %tst1 = fcmp ogt float %lhs32, %rhs32
106  %val1 = select i1 %tst1, double %a, double %b
107  store double %val1, double* @vardouble
108; CHECK: vcmpe.f32 s0, s1
109; CHECK: vselgt.f64 d16, d1, d2
110  ret void
111}
112define void @test_vsel32oge(float %lhs32, float %rhs32, float %a, float %b) {
113; CHECK: test_vsel32oge
114  %tst1 = fcmp oge float %lhs32, %rhs32
115  %val1 = select i1 %tst1, float %a, float %b
116  store float %val1, float* @varfloat
117; CHECK: vcmpe.f32 s0, s1
118; CHECK: vselge.f32 s0, s2, s3
119  ret void
120}
121define void @test_vsel64oge(float %lhs32, float %rhs32, double %a, double %b) {
122; CHECK: test_vsel64oge
123  %tst1 = fcmp oge float %lhs32, %rhs32
124  %val1 = select i1 %tst1, double %a, double %b
125  store double %val1, double* @vardouble
126; CHECK: vcmpe.f32 s0, s1
127; CHECK: vselge.f64 d16, d1, d2
128  ret void
129}
130define void @test_vsel32oeq(float %lhs32, float %rhs32, float %a, float %b) {
131; CHECK: test_vsel32oeq
132  %tst1 = fcmp oeq float %lhs32, %rhs32
133  %val1 = select i1 %tst1, float %a, float %b
134  store float %val1, float* @varfloat
135; CHECK: vcmpe.f32 s0, s1
136; CHECK: vseleq.f32 s0, s2, s3
137  ret void
138}
139define void @test_vsel64oeq(float %lhs32, float %rhs32, double %a, double %b) {
140; CHECK: test_vsel64oeq
141  %tst1 = fcmp oeq float %lhs32, %rhs32
142  %val1 = select i1 %tst1, double %a, double %b
143  store double %val1, double* @vardouble
144; CHECK: vcmpe.f32 s0, s1
145; CHECK: vseleq.f64 d16, d1, d2
146  ret void
147}
148define void @test_vsel32ugt(float %lhs32, float %rhs32, float %a, float %b) {
149; CHECK: test_vsel32ugt
150  %tst1 = fcmp ugt float %lhs32, %rhs32
151  %val1 = select i1 %tst1, float %a, float %b
152  store float %val1, float* @varfloat
153; CHECK: vcmpe.f32 s1, s0
154; CHECK: vselge.f32 s0, s3, s2
155  ret void
156}
157define void @test_vsel64ugt(float %lhs32, float %rhs32, double %a, double %b) {
158; CHECK: test_vsel64ugt
159  %tst1 = fcmp ugt float %lhs32, %rhs32
160  %val1 = select i1 %tst1, double %a, double %b
161  store double %val1, double* @vardouble
162; CHECK: vcmpe.f32 s1, s0
163; CHECK: vselge.f64 d16, d2, d1
164  ret void
165}
166define void @test_vsel32uge(float %lhs32, float %rhs32, float %a, float %b) {
167; CHECK: test_vsel32uge
168  %tst1 = fcmp uge float %lhs32, %rhs32
169  %val1 = select i1 %tst1, float %a, float %b
170  store float %val1, float* @varfloat
171; CHECK: vcmpe.f32 s1, s0
172; CHECK: vselgt.f32 s0, s3, s2
173  ret void
174}
175define void @test_vsel64uge(float %lhs32, float %rhs32, double %a, double %b) {
176; CHECK: test_vsel64uge
177  %tst1 = fcmp uge float %lhs32, %rhs32
178  %val1 = select i1 %tst1, double %a, double %b
179  store double %val1, double* @vardouble
180; CHECK: vcmpe.f32 s1, s0
181; CHECK: vselgt.f64 d16, d2, d1
182  ret void
183}
184define void @test_vsel32olt(float %lhs32, float %rhs32, float %a, float %b) {
185; CHECK: test_vsel32olt
186  %tst1 = fcmp olt float %lhs32, %rhs32
187  %val1 = select i1 %tst1, float %a, float %b
188  store float %val1, float* @varfloat
189; CHECK: vcmpe.f32 s1, s0
190; CHECK: vselgt.f32 s0, s2, s3
191  ret void
192}
193define void @test_vsel64olt(float %lhs32, float %rhs32, double %a, double %b) {
194; CHECK: test_vsel64olt
195  %tst1 = fcmp olt float %lhs32, %rhs32
196  %val1 = select i1 %tst1, double %a, double %b
197  store double %val1, double* @vardouble
198; CHECK: vcmpe.f32 s1, s0
199; CHECK: vselgt.f64 d16, d1, d2
200  ret void
201}
202define void @test_vsel32ult(float %lhs32, float %rhs32, float %a, float %b) {
203; CHECK: test_vsel32ult
204  %tst1 = fcmp ult float %lhs32, %rhs32
205  %val1 = select i1 %tst1, float %a, float %b
206  store float %val1, float* @varfloat
207; CHECK: vcmpe.f32 s0, s1
208; CHECK: vselge.f32 s0, s3, s2
209  ret void
210}
211define void @test_vsel64ult(float %lhs32, float %rhs32, double %a, double %b) {
212; CHECK: test_vsel64ult
213  %tst1 = fcmp ult float %lhs32, %rhs32
214  %val1 = select i1 %tst1, double %a, double %b
215  store double %val1, double* @vardouble
216; CHECK: vcmpe.f32 s0, s1
217; CHECK: vselge.f64 d16, d2, d1
218  ret void
219}
220define void @test_vsel32ole(float %lhs32, float %rhs32, float %a, float %b) {
221; CHECK: test_vsel32ole
222  %tst1 = fcmp ole float %lhs32, %rhs32
223  %val1 = select i1 %tst1, float %a, float %b
224  store float %val1, float* @varfloat
225; CHECK: vcmpe.f32 s1, s0
226; CHECK: vselge.f32 s0, s2, s3
227  ret void
228}
229define void @test_vsel64ole(float %lhs32, float %rhs32, double %a, double %b) {
230; CHECK: test_vsel64ole
231  %tst1 = fcmp ole float %lhs32, %rhs32
232  %val1 = select i1 %tst1, double %a, double %b
233  store double %val1, double* @vardouble
234; CHECK: vcmpe.f32 s1, s0
235; CHECK: vselge.f64 d16, d1, d2
236  ret void
237}
238define void @test_vsel32ule(float %lhs32, float %rhs32, float %a, float %b) {
239; CHECK: test_vsel32ule
240  %tst1 = fcmp ule float %lhs32, %rhs32
241  %val1 = select i1 %tst1, float %a, float %b
242  store float %val1, float* @varfloat
243; CHECK: vcmpe.f32 s0, s1
244; CHECK: vselgt.f32 s0, s3, s2
245  ret void
246}
247define void @test_vsel64ule(float %lhs32, float %rhs32, double %a, double %b) {
248; CHECK: test_vsel64ule
249  %tst1 = fcmp ule float %lhs32, %rhs32
250  %val1 = select i1 %tst1, double %a, double %b
251  store double %val1, double* @vardouble
252; CHECK: vcmpe.f32 s0, s1
253; CHECK: vselgt.f64 d16, d2, d1
254  ret void
255}
256define void @test_vsel32ord(float %lhs32, float %rhs32, float %a, float %b) {
257; CHECK: test_vsel32ord
258  %tst1 = fcmp ord float %lhs32, %rhs32
259  %val1 = select i1 %tst1, float %a, float %b
260  store float %val1, float* @varfloat
261; CHECK: vcmpe.f32 s0, s1
262; CHECK: vselvs.f32 s0, s3, s2
263  ret void
264}
265define void @test_vsel64ord(float %lhs32, float %rhs32, double %a, double %b) {
266; CHECK: test_vsel64ord
267  %tst1 = fcmp ord float %lhs32, %rhs32
268  %val1 = select i1 %tst1, double %a, double %b
269  store double %val1, double* @vardouble
270; CHECK: vcmpe.f32 s0, s1
271; CHECK: vselvs.f64 d16, d2, d1
272  ret void
273}
274define void @test_vsel32une(float %lhs32, float %rhs32, float %a, float %b) {
275; CHECK: test_vsel32une
276  %tst1 = fcmp une float %lhs32, %rhs32
277  %val1 = select i1 %tst1, float %a, float %b
278  store float %val1, float* @varfloat
279; CHECK: vcmpe.f32 s0, s1
280; CHECK: vseleq.f32 s0, s3, s2
281  ret void
282}
283define void @test_vsel64une(float %lhs32, float %rhs32, double %a, double %b) {
284; CHECK: test_vsel64une
285  %tst1 = fcmp une float %lhs32, %rhs32
286  %val1 = select i1 %tst1, double %a, double %b
287  store double %val1, double* @vardouble
288; CHECK: vcmpe.f32 s0, s1
289; CHECK: vseleq.f64 d16, d2, d1
290  ret void
291}
292define void @test_vsel32uno(float %lhs32, float %rhs32, float %a, float %b) {
293; CHECK: test_vsel32uno
294  %tst1 = fcmp uno float %lhs32, %rhs32
295  %val1 = select i1 %tst1, float %a, float %b
296  store float %val1, float* @varfloat
297; CHECK: vcmpe.f32 s0, s1
298; CHECK: vselvs.f32 s0, s2, s3
299  ret void
300}
301define void @test_vsel64uno(float %lhs32, float %rhs32, double %a, double %b) {
302; CHECK: test_vsel64uno
303  %tst1 = fcmp uno float %lhs32, %rhs32
304  %val1 = select i1 %tst1, double %a, double %b
305  store double %val1, double* @vardouble
306; CHECK: vcmpe.f32 s0, s1
307; CHECK: vselvs.f64 d16, d1, d2
308  ret void
309}
310