1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -verify-machineinstrs -mattr=+simd128 | FileCheck %s
4 ; Test that vector selects of various varieties lower correctly.
6 target triple = "wasm32-unknown-unknown"
8 ; ==============================================================================
10 ; ==============================================================================
11 define <16 x i8> @vselect_v16i8(<16 x i1> %c, <16 x i8> %x, <16 x i8> %y) {
12 ; CHECK-LABEL: vselect_v16i8:
13 ; CHECK: .functype vselect_v16i8 (v128, v128, v128) -> (v128)
14 ; CHECK-NEXT: # %bb.0:
15 ; CHECK-NEXT: local.get 1
16 ; CHECK-NEXT: local.get 2
17 ; CHECK-NEXT: local.get 0
18 ; CHECK-NEXT: i32.const 7
19 ; CHECK-NEXT: i8x16.shl
20 ; CHECK-NEXT: i32.const 7
21 ; CHECK-NEXT: i8x16.shr_s
22 ; CHECK-NEXT: v128.bitselect
23 ; CHECK-NEXT: # fallthrough-return
24 %res = select <16 x i1> %c, <16 x i8> %x, <16 x i8> %y
28 define <16 x i8> @vselect_cmp_v16i8(<16 x i8> %a, <16 x i8> %b,
29 ; CHECK-LABEL: vselect_cmp_v16i8:
30 ; CHECK: .functype vselect_cmp_v16i8 (v128, v128, v128, v128) -> (v128)
31 ; CHECK-NEXT: # %bb.0:
32 ; CHECK-NEXT: local.get 2
33 ; CHECK-NEXT: local.get 3
34 ; CHECK-NEXT: local.get 0
35 ; CHECK-NEXT: local.get 1
36 ; CHECK-NEXT: i8x16.lt_s
37 ; CHECK-NEXT: v128.bitselect
38 ; CHECK-NEXT: # fallthrough-return
39 <16 x i8> %x, <16 x i8> %y) {
40 %c = icmp slt <16 x i8> %a, %b
41 %res = select <16 x i1> %c, <16 x i8> %x, <16 x i8> %y
45 define <16 x i8> @select_v16i8(i1 zeroext %c, <16 x i8> %x, <16 x i8> %y) {
46 ; CHECK-LABEL: select_v16i8:
47 ; CHECK: .functype select_v16i8 (i32, v128, v128) -> (v128)
48 ; CHECK-NEXT: # %bb.0:
49 ; CHECK-NEXT: local.get 1
50 ; CHECK-NEXT: local.get 2
51 ; CHECK-NEXT: local.get 0
52 ; CHECK-NEXT: v128.select
53 ; CHECK-NEXT: # fallthrough-return
54 %res = select i1 %c, <16 x i8> %x, <16 x i8> %y
58 define <16 x i8> @select_cmp_v16i8(i32 %i, <16 x i8> %x, <16 x i8> %y) {
59 ; CHECK-LABEL: select_cmp_v16i8:
60 ; CHECK: .functype select_cmp_v16i8 (i32, v128, v128) -> (v128)
61 ; CHECK-NEXT: # %bb.0:
62 ; CHECK-NEXT: local.get 1
63 ; CHECK-NEXT: local.get 2
64 ; CHECK-NEXT: local.get 0
65 ; CHECK-NEXT: i32.const 0
66 ; CHECK-NEXT: i32.lt_s
67 ; CHECK-NEXT: v128.select
68 ; CHECK-NEXT: # fallthrough-return
69 %c = icmp slt i32 %i, 0
70 %res = select i1 %c, <16 x i8> %x, <16 x i8> %y
74 define <16 x i8> @select_ne_v16i8(i32 %i, <16 x i8> %x, <16 x i8> %y) {
75 ; CHECK-LABEL: select_ne_v16i8:
76 ; CHECK: .functype select_ne_v16i8 (i32, v128, v128) -> (v128)
77 ; CHECK-NEXT: # %bb.0:
78 ; CHECK-NEXT: local.get 1
79 ; CHECK-NEXT: local.get 2
80 ; CHECK-NEXT: local.get 0
81 ; CHECK-NEXT: v128.select
82 ; CHECK-NEXT: # fallthrough-return
83 %c = icmp ne i32 %i, 0
84 %res = select i1 %c, <16 x i8> %x, <16 x i8> %y
88 define <16 x i8> @select_eq_v16i8(i32 %i, <16 x i8> %x, <16 x i8> %y) {
89 ; CHECK-LABEL: select_eq_v16i8:
90 ; CHECK: .functype select_eq_v16i8 (i32, v128, v128) -> (v128)
91 ; CHECK-NEXT: # %bb.0:
92 ; CHECK-NEXT: local.get 2
93 ; CHECK-NEXT: local.get 1
94 ; CHECK-NEXT: local.get 0
95 ; CHECK-NEXT: v128.select
96 ; CHECK-NEXT: # fallthrough-return
97 %c = icmp eq i32 %i, 0
98 %res = select i1 %c, <16 x i8> %x, <16 x i8> %y
102 define <8 x i16> @vselect_v8i16(<8 x i1> %c, <8 x i16> %x, <8 x i16> %y) {
103 ; CHECK-LABEL: vselect_v8i16:
104 ; CHECK: .functype vselect_v8i16 (v128, v128, v128) -> (v128)
105 ; CHECK-NEXT: # %bb.0:
106 ; CHECK-NEXT: local.get 1
107 ; CHECK-NEXT: local.get 2
108 ; CHECK-NEXT: local.get 0
109 ; CHECK-NEXT: i32.const 15
110 ; CHECK-NEXT: i16x8.shl
111 ; CHECK-NEXT: i32.const 15
112 ; CHECK-NEXT: i16x8.shr_s
113 ; CHECK-NEXT: v128.bitselect
114 ; CHECK-NEXT: # fallthrough-return
115 %res = select <8 x i1> %c, <8 x i16> %x, <8 x i16> %y
119 define <8 x i16> @vselect_cmp_v8i16(<8 x i16> %a, <8 x i16> %b,
120 ; CHECK-LABEL: vselect_cmp_v8i16:
121 ; CHECK: .functype vselect_cmp_v8i16 (v128, v128, v128, v128) -> (v128)
122 ; CHECK-NEXT: # %bb.0:
123 ; CHECK-NEXT: local.get 2
124 ; CHECK-NEXT: local.get 3
125 ; CHECK-NEXT: local.get 0
126 ; CHECK-NEXT: local.get 1
127 ; CHECK-NEXT: i16x8.lt_s
128 ; CHECK-NEXT: v128.bitselect
129 ; CHECK-NEXT: # fallthrough-return
130 <8 x i16> %x, <8 x i16> %y) {
131 %c = icmp slt <8 x i16> %a, %b
132 %res = select <8 x i1> %c, <8 x i16> %x, <8 x i16> %y
136 define <8 x i16> @select_v8i16(i1 zeroext %c, <8 x i16> %x, <8 x i16> %y) {
137 ; CHECK-LABEL: select_v8i16:
138 ; CHECK: .functype select_v8i16 (i32, v128, v128) -> (v128)
139 ; CHECK-NEXT: # %bb.0:
140 ; CHECK-NEXT: local.get 1
141 ; CHECK-NEXT: local.get 2
142 ; CHECK-NEXT: local.get 0
143 ; CHECK-NEXT: v128.select
144 ; CHECK-NEXT: # fallthrough-return
145 %res = select i1 %c, <8 x i16> %x, <8 x i16> %y
149 define <8 x i16> @select_cmp_v8i16(i32 %i, <8 x i16> %x, <8 x i16> %y) {
150 ; CHECK-LABEL: select_cmp_v8i16:
151 ; CHECK: .functype select_cmp_v8i16 (i32, v128, v128) -> (v128)
152 ; CHECK-NEXT: # %bb.0:
153 ; CHECK-NEXT: local.get 1
154 ; CHECK-NEXT: local.get 2
155 ; CHECK-NEXT: local.get 0
156 ; CHECK-NEXT: i32.const 0
157 ; CHECK-NEXT: i32.lt_s
158 ; CHECK-NEXT: v128.select
159 ; CHECK-NEXT: # fallthrough-return
160 %c = icmp slt i32 %i, 0
161 %res = select i1 %c, <8 x i16> %x, <8 x i16> %y
165 define <8 x i16> @select_ne_v8i16(i32 %i, <8 x i16> %x, <8 x i16> %y) {
166 ; CHECK-LABEL: select_ne_v8i16:
167 ; CHECK: .functype select_ne_v8i16 (i32, v128, v128) -> (v128)
168 ; CHECK-NEXT: # %bb.0:
169 ; CHECK-NEXT: local.get 1
170 ; CHECK-NEXT: local.get 2
171 ; CHECK-NEXT: local.get 0
172 ; CHECK-NEXT: v128.select
173 ; CHECK-NEXT: # fallthrough-return
174 %c = icmp ne i32 %i, 0
175 %res = select i1 %c, <8 x i16> %x, <8 x i16> %y
179 define <8 x i16> @select_eq_v8i16(i32 %i, <8 x i16> %x, <8 x i16> %y) {
180 ; CHECK-LABEL: select_eq_v8i16:
181 ; CHECK: .functype select_eq_v8i16 (i32, v128, v128) -> (v128)
182 ; CHECK-NEXT: # %bb.0:
183 ; CHECK-NEXT: local.get 2
184 ; CHECK-NEXT: local.get 1
185 ; CHECK-NEXT: local.get 0
186 ; CHECK-NEXT: v128.select
187 ; CHECK-NEXT: # fallthrough-return
188 %c = icmp eq i32 %i, 0
189 %res = select i1 %c, <8 x i16> %x, <8 x i16> %y
193 define <4 x i32> @vselect_v4i32(<4 x i1> %c, <4 x i32> %x, <4 x i32> %y) {
194 ; CHECK-LABEL: vselect_v4i32:
195 ; CHECK: .functype vselect_v4i32 (v128, v128, v128) -> (v128)
196 ; CHECK-NEXT: # %bb.0:
197 ; CHECK-NEXT: local.get 1
198 ; CHECK-NEXT: local.get 2
199 ; CHECK-NEXT: local.get 0
200 ; CHECK-NEXT: i32.const 31
201 ; CHECK-NEXT: i32x4.shl
202 ; CHECK-NEXT: i32.const 31
203 ; CHECK-NEXT: i32x4.shr_s
204 ; CHECK-NEXT: v128.bitselect
205 ; CHECK-NEXT: # fallthrough-return
206 %res = select <4 x i1> %c, <4 x i32> %x, <4 x i32> %y
210 define <4 x i32> @vselect_cmp_v4i32(<4 x i32> %a, <4 x i32> %b,
211 ; CHECK-LABEL: vselect_cmp_v4i32:
212 ; CHECK: .functype vselect_cmp_v4i32 (v128, v128, v128, v128) -> (v128)
213 ; CHECK-NEXT: # %bb.0:
214 ; CHECK-NEXT: local.get 2
215 ; CHECK-NEXT: local.get 3
216 ; CHECK-NEXT: local.get 0
217 ; CHECK-NEXT: local.get 1
218 ; CHECK-NEXT: i32x4.lt_s
219 ; CHECK-NEXT: v128.bitselect
220 ; CHECK-NEXT: # fallthrough-return
221 <4 x i32> %x, <4 x i32> %y) {
222 %c = icmp slt <4 x i32> %a, %b
223 %res = select <4 x i1> %c, <4 x i32> %x, <4 x i32> %y
227 define <4 x i32> @select_v4i32(i1 zeroext %c, <4 x i32> %x, <4 x i32> %y) {
228 ; CHECK-LABEL: select_v4i32:
229 ; CHECK: .functype select_v4i32 (i32, v128, v128) -> (v128)
230 ; CHECK-NEXT: # %bb.0:
231 ; CHECK-NEXT: local.get 1
232 ; CHECK-NEXT: local.get 2
233 ; CHECK-NEXT: local.get 0
234 ; CHECK-NEXT: v128.select
235 ; CHECK-NEXT: # fallthrough-return
236 %res = select i1 %c, <4 x i32> %x, <4 x i32> %y
240 define <4 x i32> @select_cmp_v4i32(i32 %i, <4 x i32> %x, <4 x i32> %y) {
241 ; CHECK-LABEL: select_cmp_v4i32:
242 ; CHECK: .functype select_cmp_v4i32 (i32, v128, v128) -> (v128)
243 ; CHECK-NEXT: # %bb.0:
244 ; CHECK-NEXT: local.get 1
245 ; CHECK-NEXT: local.get 2
246 ; CHECK-NEXT: local.get 0
247 ; CHECK-NEXT: i32.const 0
248 ; CHECK-NEXT: i32.lt_s
249 ; CHECK-NEXT: v128.select
250 ; CHECK-NEXT: # fallthrough-return
251 %c = icmp slt i32 %i, 0
252 %res = select i1 %c, <4 x i32> %x, <4 x i32> %y
256 define <4 x i32> @select_ne_v4i32(i32 %i, <4 x i32> %x, <4 x i32> %y) {
257 ; CHECK-LABEL: select_ne_v4i32:
258 ; CHECK: .functype select_ne_v4i32 (i32, v128, v128) -> (v128)
259 ; CHECK-NEXT: # %bb.0:
260 ; CHECK-NEXT: local.get 1
261 ; CHECK-NEXT: local.get 2
262 ; CHECK-NEXT: local.get 0
263 ; CHECK-NEXT: v128.select
264 ; CHECK-NEXT: # fallthrough-return
265 %c = icmp ne i32 %i, 0
266 %res = select i1 %c, <4 x i32> %x, <4 x i32> %y
270 define <4 x i32> @select_eq_v4i32(i32 %i, <4 x i32> %x, <4 x i32> %y) {
271 ; CHECK-LABEL: select_eq_v4i32:
272 ; CHECK: .functype select_eq_v4i32 (i32, v128, v128) -> (v128)
273 ; CHECK-NEXT: # %bb.0:
274 ; CHECK-NEXT: local.get 2
275 ; CHECK-NEXT: local.get 1
276 ; CHECK-NEXT: local.get 0
277 ; CHECK-NEXT: v128.select
278 ; CHECK-NEXT: # fallthrough-return
279 %c = icmp eq i32 %i, 0
280 %res = select i1 %c, <4 x i32> %x, <4 x i32> %y
284 define <2 x i64> @vselect_v2i64(<2 x i1> %c, <2 x i64> %x, <2 x i64> %y) {
285 ; CHECK-LABEL: vselect_v2i64:
286 ; CHECK: .functype vselect_v2i64 (v128, v128, v128) -> (v128)
287 ; CHECK-NEXT: # %bb.0:
288 ; CHECK-NEXT: local.get 1
289 ; CHECK-NEXT: local.get 2
290 ; CHECK-NEXT: local.get 0
291 ; CHECK-NEXT: i32.const 63
292 ; CHECK-NEXT: i64x2.shl
293 ; CHECK-NEXT: i32.const 63
294 ; CHECK-NEXT: i64x2.shr_s
295 ; CHECK-NEXT: v128.bitselect
296 ; CHECK-NEXT: # fallthrough-return
297 %res = select <2 x i1> %c, <2 x i64> %x, <2 x i64> %y
301 define <2 x i64> @vselect_cmp_v2i64(<2 x i64> %a, <2 x i64> %b, <2 x i64> %x, <2 x i64> %y) {
302 ; CHECK-LABEL: vselect_cmp_v2i64:
303 ; CHECK: .functype vselect_cmp_v2i64 (v128, v128, v128, v128) -> (v128)
304 ; CHECK-NEXT: # %bb.0:
305 ; CHECK-NEXT: local.get 2
306 ; CHECK-NEXT: local.get 3
307 ; CHECK-NEXT: local.get 0
308 ; CHECK-NEXT: local.get 1
309 ; CHECK-NEXT: i64x2.lt_s
310 ; CHECK-NEXT: v128.bitselect
311 ; CHECK-NEXT: # fallthrough-return
312 %c = icmp slt <2 x i64> %a, %b
313 %res = select <2 x i1> %c, <2 x i64> %x, <2 x i64> %y
317 define <2 x i64> @select_v2i64(i1 zeroext %c, <2 x i64> %x, <2 x i64> %y) {
318 ; CHECK-LABEL: select_v2i64:
319 ; CHECK: .functype select_v2i64 (i32, v128, v128) -> (v128)
320 ; CHECK-NEXT: # %bb.0:
321 ; CHECK-NEXT: local.get 1
322 ; CHECK-NEXT: local.get 2
323 ; CHECK-NEXT: local.get 0
324 ; CHECK-NEXT: v128.select
325 ; CHECK-NEXT: # fallthrough-return
326 %res = select i1 %c, <2 x i64> %x, <2 x i64> %y
330 define <2 x i64> @select_cmp_v2i64(i32 %i, <2 x i64> %x, <2 x i64> %y) {
331 ; CHECK-LABEL: select_cmp_v2i64:
332 ; CHECK: .functype select_cmp_v2i64 (i32, v128, v128) -> (v128)
333 ; CHECK-NEXT: # %bb.0:
334 ; CHECK-NEXT: local.get 1
335 ; CHECK-NEXT: local.get 2
336 ; CHECK-NEXT: local.get 0
337 ; CHECK-NEXT: i32.const 0
338 ; CHECK-NEXT: i32.lt_s
339 ; CHECK-NEXT: v128.select
340 ; CHECK-NEXT: # fallthrough-return
341 %c = icmp slt i32 %i, 0
342 %res = select i1 %c, <2 x i64> %x, <2 x i64> %y
346 define <2 x i64> @select_ne_v2i64(i32 %i, <2 x i64> %x, <2 x i64> %y) {
347 ; CHECK-LABEL: select_ne_v2i64:
348 ; CHECK: .functype select_ne_v2i64 (i32, v128, v128) -> (v128)
349 ; CHECK-NEXT: # %bb.0:
350 ; CHECK-NEXT: local.get 1
351 ; CHECK-NEXT: local.get 2
352 ; CHECK-NEXT: local.get 0
353 ; CHECK-NEXT: v128.select
354 ; CHECK-NEXT: # fallthrough-return
355 %c = icmp ne i32 %i, 0
356 %res = select i1 %c, <2 x i64> %x, <2 x i64> %y
360 define <2 x i64> @select_eq_v2i64(i32 %i, <2 x i64> %x, <2 x i64> %y) {
361 ; CHECK-LABEL: select_eq_v2i64:
362 ; CHECK: .functype select_eq_v2i64 (i32, v128, v128) -> (v128)
363 ; CHECK-NEXT: # %bb.0:
364 ; CHECK-NEXT: local.get 2
365 ; CHECK-NEXT: local.get 1
366 ; CHECK-NEXT: local.get 0
367 ; CHECK-NEXT: v128.select
368 ; CHECK-NEXT: # fallthrough-return
369 %c = icmp eq i32 %i, 0
370 %res = select i1 %c, <2 x i64> %x, <2 x i64> %y
374 define <4 x float> @vselect_v4f32(<4 x i1> %c, <4 x float> %x, <4 x float> %y) {
375 ; CHECK-LABEL: vselect_v4f32:
376 ; CHECK: .functype vselect_v4f32 (v128, v128, v128) -> (v128)
377 ; CHECK-NEXT: # %bb.0:
378 ; CHECK-NEXT: local.get 1
379 ; CHECK-NEXT: local.get 2
380 ; CHECK-NEXT: local.get 0
381 ; CHECK-NEXT: i32.const 31
382 ; CHECK-NEXT: i32x4.shl
383 ; CHECK-NEXT: i32.const 31
384 ; CHECK-NEXT: i32x4.shr_s
385 ; CHECK-NEXT: v128.bitselect
386 ; CHECK-NEXT: # fallthrough-return
387 %res = select <4 x i1> %c, <4 x float> %x, <4 x float> %y
391 define <4 x float> @vselect_cmp_v4f32(<4 x float> %a, <4 x float> %b,
392 ; CHECK-LABEL: vselect_cmp_v4f32:
393 ; CHECK: .functype vselect_cmp_v4f32 (v128, v128, v128, v128) -> (v128)
394 ; CHECK-NEXT: # %bb.0:
395 ; CHECK-NEXT: local.get 2
396 ; CHECK-NEXT: local.get 3
397 ; CHECK-NEXT: local.get 0
398 ; CHECK-NEXT: local.get 1
399 ; CHECK-NEXT: f32x4.lt
400 ; CHECK-NEXT: v128.bitselect
401 ; CHECK-NEXT: # fallthrough-return
402 <4 x float> %x, <4 x float> %y) {
403 %c = fcmp olt <4 x float> %a, %b
404 %res = select <4 x i1> %c, <4 x float> %x, <4 x float> %y
408 define <4 x float> @select_v4f32(i1 zeroext %c, <4 x float> %x, <4 x float> %y) {
409 ; CHECK-LABEL: select_v4f32:
410 ; CHECK: .functype select_v4f32 (i32, v128, v128) -> (v128)
411 ; CHECK-NEXT: # %bb.0:
412 ; CHECK-NEXT: local.get 1
413 ; CHECK-NEXT: local.get 2
414 ; CHECK-NEXT: local.get 0
415 ; CHECK-NEXT: v128.select
416 ; CHECK-NEXT: # fallthrough-return
417 %res = select i1 %c, <4 x float> %x, <4 x float> %y
421 define <4 x float> @select_cmp_v4f32(i32 %i, <4 x float> %x, <4 x float> %y) {
422 ; CHECK-LABEL: select_cmp_v4f32:
423 ; CHECK: .functype select_cmp_v4f32 (i32, v128, v128) -> (v128)
424 ; CHECK-NEXT: # %bb.0:
425 ; CHECK-NEXT: local.get 1
426 ; CHECK-NEXT: local.get 2
427 ; CHECK-NEXT: local.get 0
428 ; CHECK-NEXT: i32.const 0
429 ; CHECK-NEXT: i32.lt_s
430 ; CHECK-NEXT: v128.select
431 ; CHECK-NEXT: # fallthrough-return
432 %c = icmp slt i32 %i, 0
433 %res = select i1 %c, <4 x float> %x, <4 x float> %y
437 define <4 x float> @select_ne_v4f32(i32 %i, <4 x float> %x, <4 x float> %y) {
438 ; CHECK-LABEL: select_ne_v4f32:
439 ; CHECK: .functype select_ne_v4f32 (i32, v128, v128) -> (v128)
440 ; CHECK-NEXT: # %bb.0:
441 ; CHECK-NEXT: local.get 1
442 ; CHECK-NEXT: local.get 2
443 ; CHECK-NEXT: local.get 0
444 ; CHECK-NEXT: v128.select
445 ; CHECK-NEXT: # fallthrough-return
446 %c = icmp ne i32 %i, 0
447 %res = select i1 %c, <4 x float> %x, <4 x float> %y
451 define <4 x float> @select_eq_v4f32(i32 %i, <4 x float> %x, <4 x float> %y) {
452 ; CHECK-LABEL: select_eq_v4f32:
453 ; CHECK: .functype select_eq_v4f32 (i32, v128, v128) -> (v128)
454 ; CHECK-NEXT: # %bb.0:
455 ; CHECK-NEXT: local.get 2
456 ; CHECK-NEXT: local.get 1
457 ; CHECK-NEXT: local.get 0
458 ; CHECK-NEXT: v128.select
459 ; CHECK-NEXT: # fallthrough-return
460 %c = icmp eq i32 %i, 0
461 %res = select i1 %c, <4 x float> %x, <4 x float> %y
465 define <2 x double> @vselect_v2f64(<2 x i1> %c, <2 x double> %x, <2 x double> %y) {
466 ; CHECK-LABEL: vselect_v2f64:
467 ; CHECK: .functype vselect_v2f64 (v128, v128, v128) -> (v128)
468 ; CHECK-NEXT: # %bb.0:
469 ; CHECK-NEXT: local.get 1
470 ; CHECK-NEXT: local.get 2
471 ; CHECK-NEXT: local.get 0
472 ; CHECK-NEXT: i32.const 63
473 ; CHECK-NEXT: i64x2.shl
474 ; CHECK-NEXT: i32.const 63
475 ; CHECK-NEXT: i64x2.shr_s
476 ; CHECK-NEXT: v128.bitselect
477 ; CHECK-NEXT: # fallthrough-return
478 %res = select <2 x i1> %c, <2 x double> %x, <2 x double> %y
479 ret <2 x double> %res
482 define <2 x double> @vselect_cmp_v2f64(<2 x double> %a, <2 x double> %b,
483 ; CHECK-LABEL: vselect_cmp_v2f64:
484 ; CHECK: .functype vselect_cmp_v2f64 (v128, v128, v128, v128) -> (v128)
485 ; CHECK-NEXT: # %bb.0:
486 ; CHECK-NEXT: local.get 2
487 ; CHECK-NEXT: local.get 3
488 ; CHECK-NEXT: local.get 0
489 ; CHECK-NEXT: local.get 1
490 ; CHECK-NEXT: f64x2.lt
491 ; CHECK-NEXT: v128.bitselect
492 ; CHECK-NEXT: # fallthrough-return
493 <2 x double> %x, <2 x double> %y) {
494 %c = fcmp olt <2 x double> %a, %b
495 %res = select <2 x i1> %c, <2 x double> %x, <2 x double> %y
496 ret <2 x double> %res
499 define <2 x double> @select_v2f64(i1 zeroext %c, <2 x double> %x, <2 x double> %y) {
500 ; CHECK-LABEL: select_v2f64:
501 ; CHECK: .functype select_v2f64 (i32, v128, v128) -> (v128)
502 ; CHECK-NEXT: # %bb.0:
503 ; CHECK-NEXT: local.get 1
504 ; CHECK-NEXT: local.get 2
505 ; CHECK-NEXT: local.get 0
506 ; CHECK-NEXT: v128.select
507 ; CHECK-NEXT: # fallthrough-return
508 %res = select i1 %c, <2 x double> %x, <2 x double> %y
509 ret <2 x double> %res
512 define <2 x double> @select_cmp_v2f64(i32 %i, <2 x double> %x, <2 x double> %y) {
513 ; CHECK-LABEL: select_cmp_v2f64:
514 ; CHECK: .functype select_cmp_v2f64 (i32, v128, v128) -> (v128)
515 ; CHECK-NEXT: # %bb.0:
516 ; CHECK-NEXT: local.get 1
517 ; CHECK-NEXT: local.get 2
518 ; CHECK-NEXT: local.get 0
519 ; CHECK-NEXT: i32.const 0
520 ; CHECK-NEXT: i32.lt_s
521 ; CHECK-NEXT: v128.select
522 ; CHECK-NEXT: # fallthrough-return
523 %c = icmp slt i32 %i, 0
524 %res = select i1 %c, <2 x double> %x, <2 x double> %y
525 ret <2 x double> %res
528 define <2 x double> @select_ne_v2f64(i32 %i, <2 x double> %x, <2 x double> %y) {
529 ; CHECK-LABEL: select_ne_v2f64:
530 ; CHECK: .functype select_ne_v2f64 (i32, v128, v128) -> (v128)
531 ; CHECK-NEXT: # %bb.0:
532 ; CHECK-NEXT: local.get 1
533 ; CHECK-NEXT: local.get 2
534 ; CHECK-NEXT: local.get 0
535 ; CHECK-NEXT: v128.select
536 ; CHECK-NEXT: # fallthrough-return
537 %c = icmp ne i32 %i, 0
538 %res = select i1 %c, <2 x double> %x, <2 x double> %y
539 ret <2 x double> %res
542 define <2 x double> @select_eq_v2f64(i32 %i, <2 x double> %x, <2 x double> %y) {
543 ; CHECK-LABEL: select_eq_v2f64:
544 ; CHECK: .functype select_eq_v2f64 (i32, v128, v128) -> (v128)
545 ; CHECK-NEXT: # %bb.0:
546 ; CHECK-NEXT: local.get 2
547 ; CHECK-NEXT: local.get 1
548 ; CHECK-NEXT: local.get 0
549 ; CHECK-NEXT: v128.select
550 ; CHECK-NEXT: # fallthrough-return
551 %c = icmp eq i32 %i, 0
552 %res = select i1 %c, <2 x double> %x, <2 x double> %y
553 ret <2 x double> %res