1 ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128 | FileCheck %s
3 ; Test that operations that are not supported by SIMD are properly
6 target triple = "wasm32-unknown-unknown"
8 ; ==============================================================================
10 ; ==============================================================================
12 ; CHECK-LABEL: ctlz_v16i8:
14 declare <16 x i8> @llvm.ctlz.v16i8(<16 x i8>, i1)
15 define <16 x i8> @ctlz_v16i8(<16 x i8> %x) {
16 %v = call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %x, i1 false)
20 ; CHECK-LABEL: ctlz_v16i8_undef:
22 define <16 x i8> @ctlz_v16i8_undef(<16 x i8> %x) {
23 %v = call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %x, i1 true)
27 ; CHECK-LABEL: cttz_v16i8:
29 declare <16 x i8> @llvm.cttz.v16i8(<16 x i8>, i1)
30 define <16 x i8> @cttz_v16i8(<16 x i8> %x) {
31 %v = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %x, i1 false)
35 ; CHECK-LABEL: cttz_v16i8_undef:
37 define <16 x i8> @cttz_v16i8_undef(<16 x i8> %x) {
38 %v = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %x, i1 true)
42 ; CHECK-LABEL: sdiv_v16i8:
44 define <16 x i8> @sdiv_v16i8(<16 x i8> %x, <16 x i8> %y) {
45 %v = sdiv <16 x i8> %x, %y
49 ; CHECK-LABEL: udiv_v16i8:
51 define <16 x i8> @udiv_v16i8(<16 x i8> %x, <16 x i8> %y) {
52 %v = udiv <16 x i8> %x, %y
56 ; CHECK-LABEL: srem_v16i8:
58 define <16 x i8> @srem_v16i8(<16 x i8> %x, <16 x i8> %y) {
59 %v = srem <16 x i8> %x, %y
63 ; CHECK-LABEL: urem_v16i8:
65 define <16 x i8> @urem_v16i8(<16 x i8> %x, <16 x i8> %y) {
66 %v = urem <16 x i8> %x, %y
70 ; CHECK-LABEL: rotl_v16i8:
71 ; Note: expansion does not use i32.rotl
73 declare <16 x i8> @llvm.fshl.v16i8(<16 x i8>, <16 x i8>, <16 x i8>)
74 define <16 x i8> @rotl_v16i8(<16 x i8> %x, <16 x i8> %y) {
75 %v = call <16 x i8> @llvm.fshl.v16i8(<16 x i8> %x, <16 x i8> %x, <16 x i8> %y)
79 ; CHECK-LABEL: rotr_v16i8:
80 ; Note: expansion does not use i32.rotr
82 declare <16 x i8> @llvm.fshr.v16i8(<16 x i8>, <16 x i8>, <16 x i8>)
83 define <16 x i8> @rotr_v16i8(<16 x i8> %x, <16 x i8> %y) {
84 %v = call <16 x i8> @llvm.fshr.v16i8(<16 x i8> %x, <16 x i8> %x, <16 x i8> %y)
88 ; ==============================================================================
90 ; ==============================================================================
92 ; CHECK-LABEL: ctlz_v8i16:
94 declare <8 x i16> @llvm.ctlz.v8i16(<8 x i16>, i1)
95 define <8 x i16> @ctlz_v8i16(<8 x i16> %x) {
96 %v = call <8 x i16> @llvm.ctlz.v8i16(<8 x i16> %x, i1 false)
100 ; CHECK-LABEL: ctlz_v8i16_undef:
102 define <8 x i16> @ctlz_v8i16_undef(<8 x i16> %x) {
103 %v = call <8 x i16> @llvm.ctlz.v8i16(<8 x i16> %x, i1 true)
107 ; CHECK-LABEL: cttz_v8i16:
109 declare <8 x i16> @llvm.cttz.v8i16(<8 x i16>, i1)
110 define <8 x i16> @cttz_v8i16(<8 x i16> %x) {
111 %v = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %x, i1 false)
115 ; CHECK-LABEL: cttz_v8i16_undef:
117 define <8 x i16> @cttz_v8i16_undef(<8 x i16> %x) {
118 %v = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %x, i1 true)
122 ; CHECK-LABEL: ctpop_v8i16:
123 ; Note: expansion does not use i32.popcnt
125 declare <8 x i16> @llvm.ctpop.v8i16(<8 x i16>)
126 define <8 x i16> @ctpop_v8i16(<8 x i16> %x) {
127 %v = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %x)
131 ; CHECK-LABEL: sdiv_v8i16:
133 define <8 x i16> @sdiv_v8i16(<8 x i16> %x, <8 x i16> %y) {
134 %v = sdiv <8 x i16> %x, %y
138 ; CHECK-LABEL: udiv_v8i16:
140 define <8 x i16> @udiv_v8i16(<8 x i16> %x, <8 x i16> %y) {
141 %v = udiv <8 x i16> %x, %y
145 ; CHECK-LABEL: srem_v8i16:
147 define <8 x i16> @srem_v8i16(<8 x i16> %x, <8 x i16> %y) {
148 %v = srem <8 x i16> %x, %y
152 ; CHECK-LABEL: urem_v8i16:
154 define <8 x i16> @urem_v8i16(<8 x i16> %x, <8 x i16> %y) {
155 %v = urem <8 x i16> %x, %y
159 ; CHECK-LABEL: rotl_v8i16:
160 ; Note: expansion does not use i32.rotl
162 declare <8 x i16> @llvm.fshl.v8i16(<8 x i16>, <8 x i16>, <8 x i16>)
163 define <8 x i16> @rotl_v8i16(<8 x i16> %x, <8 x i16> %y) {
164 %v = call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %x, <8 x i16> %x, <8 x i16> %y)
168 ; CHECK-LABEL: rotr_v8i16:
169 ; Note: expansion does not use i32.rotr
171 declare <8 x i16> @llvm.fshr.v8i16(<8 x i16>, <8 x i16>, <8 x i16>)
172 define <8 x i16> @rotr_v8i16(<8 x i16> %x, <8 x i16> %y) {
173 %v = call <8 x i16> @llvm.fshr.v8i16(<8 x i16> %x, <8 x i16> %x, <8 x i16> %y)
177 ; ==============================================================================
179 ; ==============================================================================
181 ; CHECK-LABEL: ctlz_v4i32:
183 declare <4 x i32> @llvm.ctlz.v4i32(<4 x i32>, i1)
184 define <4 x i32> @ctlz_v4i32(<4 x i32> %x) {
185 %v = call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %x, i1 false)
189 ; CHECK-LABEL: ctlz_v4i32_undef:
191 define <4 x i32> @ctlz_v4i32_undef(<4 x i32> %x) {
192 %v = call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %x, i1 true)
196 ; CHECK-LABEL: cttz_v4i32:
198 declare <4 x i32> @llvm.cttz.v4i32(<4 x i32>, i1)
199 define <4 x i32> @cttz_v4i32(<4 x i32> %x) {
200 %v = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %x, i1 false)
204 ; CHECK-LABEL: cttz_v4i32_undef:
206 define <4 x i32> @cttz_v4i32_undef(<4 x i32> %x) {
207 %v = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %x, i1 true)
211 ; CHECK-LABEL: ctpop_v4i32:
212 ; Note: expansion does not use i32.popcnt
214 declare <4 x i32> @llvm.ctpop.v4i32(<4 x i32>)
215 define <4 x i32> @ctpop_v4i32(<4 x i32> %x) {
216 %v = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %x)
220 ; CHECK-LABEL: sdiv_v4i32:
222 define <4 x i32> @sdiv_v4i32(<4 x i32> %x, <4 x i32> %y) {
223 %v = sdiv <4 x i32> %x, %y
227 ; CHECK-LABEL: udiv_v4i32:
229 define <4 x i32> @udiv_v4i32(<4 x i32> %x, <4 x i32> %y) {
230 %v = udiv <4 x i32> %x, %y
234 ; CHECK-LABEL: srem_v4i32:
236 define <4 x i32> @srem_v4i32(<4 x i32> %x, <4 x i32> %y) {
237 %v = srem <4 x i32> %x, %y
241 ; CHECK-LABEL: urem_v4i32:
243 define <4 x i32> @urem_v4i32(<4 x i32> %x, <4 x i32> %y) {
244 %v = urem <4 x i32> %x, %y
248 ; CHECK-LABEL: rotl_v4i32:
249 ; Note: expansion does not use i32.rotl
251 declare <4 x i32> @llvm.fshl.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
252 define <4 x i32> @rotl_v4i32(<4 x i32> %x, <4 x i32> %y) {
253 %v = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %x, <4 x i32> %x, <4 x i32> %y)
257 ; CHECK-LABEL: rotr_v4i32:
258 ; Note: expansion does not use i32.rotr
260 declare <4 x i32> @llvm.fshr.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
261 define <4 x i32> @rotr_v4i32(<4 x i32> %x, <4 x i32> %y) {
262 %v = call <4 x i32> @llvm.fshr.v4i32(<4 x i32> %x, <4 x i32> %x, <4 x i32> %y)
266 ; ==============================================================================
268 ; ==============================================================================
270 ; CHECK-LABEL: ctlz_v2i64:
272 declare <2 x i64> @llvm.ctlz.v2i64(<2 x i64>, i1)
273 define <2 x i64> @ctlz_v2i64(<2 x i64> %x) {
274 %v = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %x, i1 false)
278 ; CHECK-LABEL: ctlz_v2i64_undef:
280 define <2 x i64> @ctlz_v2i64_undef(<2 x i64> %x) {
281 %v = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %x, i1 true)
285 ; CHECK-LABEL: cttz_v2i64:
287 declare <2 x i64> @llvm.cttz.v2i64(<2 x i64>, i1)
288 define <2 x i64> @cttz_v2i64(<2 x i64> %x) {
289 %v = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %x, i1 false)
293 ; CHECK-LABEL: cttz_v2i64_undef:
295 define <2 x i64> @cttz_v2i64_undef(<2 x i64> %x) {
296 %v = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %x, i1 true)
300 ; CHECK-LABEL: ctpop_v2i64:
301 ; Note: expansion does not use i64.popcnt
303 declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>)
304 define <2 x i64> @ctpop_v2i64(<2 x i64> %x) {
305 %v = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %x)
309 ; CHECK-LABEL: sdiv_v2i64:
311 define <2 x i64> @sdiv_v2i64(<2 x i64> %x, <2 x i64> %y) {
312 %v = sdiv <2 x i64> %x, %y
316 ; CHECK-LABEL: udiv_v2i64:
318 define <2 x i64> @udiv_v2i64(<2 x i64> %x, <2 x i64> %y) {
319 %v = udiv <2 x i64> %x, %y
323 ; CHECK-LABEL: srem_v2i64:
325 define <2 x i64> @srem_v2i64(<2 x i64> %x, <2 x i64> %y) {
326 %v = srem <2 x i64> %x, %y
330 ; CHECK-LABEL: urem_v2i64:
332 define <2 x i64> @urem_v2i64(<2 x i64> %x, <2 x i64> %y) {
333 %v = urem <2 x i64> %x, %y
337 ; CHECK-LABEL: rotl_v2i64:
338 ; Note: expansion does not use i64.rotl
340 declare <2 x i64> @llvm.fshl.v2i64(<2 x i64>, <2 x i64>, <2 x i64>)
341 define <2 x i64> @rotl_v2i64(<2 x i64> %x, <2 x i64> %y) {
342 %v = call <2 x i64> @llvm.fshl.v2i64(<2 x i64> %x, <2 x i64> %x, <2 x i64> %y)
346 ; CHECK-LABEL: rotr_v2i64:
347 ; Note: expansion does not use i64.rotr
349 declare <2 x i64> @llvm.fshr.v2i64(<2 x i64>, <2 x i64>, <2 x i64>)
350 define <2 x i64> @rotr_v2i64(<2 x i64> %x, <2 x i64> %y) {
351 %v = call <2 x i64> @llvm.fshr.v2i64(<2 x i64> %x, <2 x i64> %x, <2 x i64> %y)
355 ; ==============================================================================
357 ; ==============================================================================
359 ; CHECK-LABEL: copysign_v4f32:
360 ; CHECK: f32.copysign
361 declare <4 x float> @llvm.copysign.v4f32(<4 x float>, <4 x float>)
362 define <4 x float> @copysign_v4f32(<4 x float> %x, <4 x float> %y) {
363 %v = call <4 x float> @llvm.copysign.v4f32(<4 x float> %x, <4 x float> %y)
367 ; CHECK-LABEL: sin_v4f32:
368 ; CHECK: call $push[[L:[0-9]+]]=, sinf
369 declare <4 x float> @llvm.sin.v4f32(<4 x float>)
370 define <4 x float> @sin_v4f32(<4 x float> %x) {
371 %v = call <4 x float> @llvm.sin.v4f32(<4 x float> %x)
375 ; CHECK-LABEL: cos_v4f32:
376 ; CHECK: call $push[[L:[0-9]+]]=, cosf
377 declare <4 x float> @llvm.cos.v4f32(<4 x float>)
378 define <4 x float> @cos_v4f32(<4 x float> %x) {
379 %v = call <4 x float> @llvm.cos.v4f32(<4 x float> %x)
383 ; CHECK-LABEL: powi_v4f32:
384 ; CHECK: call $push[[L:[0-9]+]]=, __powisf2
385 declare <4 x float> @llvm.powi.v4f32.i32(<4 x float>, i32)
386 define <4 x float> @powi_v4f32(<4 x float> %x, i32 %y) {
387 %v = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> %x, i32 %y)
391 ; CHECK-LABEL: pow_v4f32:
392 ; CHECK: call $push[[L:[0-9]+]]=, powf
393 declare <4 x float> @llvm.pow.v4f32(<4 x float>, <4 x float>)
394 define <4 x float> @pow_v4f32(<4 x float> %x, <4 x float> %y) {
395 %v = call <4 x float> @llvm.pow.v4f32(<4 x float> %x, <4 x float> %y)
399 ; CHECK-LABEL: log_v4f32:
400 ; CHECK: call $push[[L:[0-9]+]]=, logf
401 declare <4 x float> @llvm.log.v4f32(<4 x float>)
402 define <4 x float> @log_v4f32(<4 x float> %x) {
403 %v = call <4 x float> @llvm.log.v4f32(<4 x float> %x)
407 ; CHECK-LABEL: log2_v4f32:
408 ; CHECK: call $push[[L:[0-9]+]]=, log2f
409 declare <4 x float> @llvm.log2.v4f32(<4 x float>)
410 define <4 x float> @log2_v4f32(<4 x float> %x) {
411 %v = call <4 x float> @llvm.log2.v4f32(<4 x float> %x)
415 ; CHECK-LABEL: log10_v4f32:
416 ; CHECK: call $push[[L:[0-9]+]]=, log10f
417 declare <4 x float> @llvm.log10.v4f32(<4 x float>)
418 define <4 x float> @log10_v4f32(<4 x float> %x) {
419 %v = call <4 x float> @llvm.log10.v4f32(<4 x float> %x)
423 ; CHECK-LABEL: exp_v4f32:
424 ; CHECK: call $push[[L:[0-9]+]]=, expf
425 declare <4 x float> @llvm.exp.v4f32(<4 x float>)
426 define <4 x float> @exp_v4f32(<4 x float> %x) {
427 %v = call <4 x float> @llvm.exp.v4f32(<4 x float> %x)
431 ; CHECK-LABEL: exp2_v4f32:
432 ; CHECK: call $push[[L:[0-9]+]]=, exp2f
433 declare <4 x float> @llvm.exp2.v4f32(<4 x float>)
434 define <4 x float> @exp2_v4f32(<4 x float> %x) {
435 %v = call <4 x float> @llvm.exp2.v4f32(<4 x float> %x)
439 ; CHECK-LABEL: rint_v4f32:
441 declare <4 x float> @llvm.rint.v4f32(<4 x float>)
442 define <4 x float> @rint_v4f32(<4 x float> %x) {
443 %v = call <4 x float> @llvm.rint.v4f32(<4 x float> %x)
447 ; CHECK-LABEL: round_v4f32:
448 ; CHECK: call $push[[L:[0-9]+]]=, roundf
449 declare <4 x float> @llvm.round.v4f32(<4 x float>)
450 define <4 x float> @round_v4f32(<4 x float> %x) {
451 %v = call <4 x float> @llvm.round.v4f32(<4 x float> %x)
455 ; ==============================================================================
457 ; ==============================================================================
459 ; CHECK-LABEL: copysign_v2f64:
460 ; CHECK: f64.copysign
461 declare <2 x double> @llvm.copysign.v2f64(<2 x double>, <2 x double>)
462 define <2 x double> @copysign_v2f64(<2 x double> %x, <2 x double> %y) {
463 %v = call <2 x double> @llvm.copysign.v2f64(<2 x double> %x, <2 x double> %y)
467 ; CHECK-LABEL: sin_v2f64:
468 ; CHECK: call $push[[L:[0-9]+]]=, sin
469 declare <2 x double> @llvm.sin.v2f64(<2 x double>)
470 define <2 x double> @sin_v2f64(<2 x double> %x) {
471 %v = call <2 x double> @llvm.sin.v2f64(<2 x double> %x)
475 ; CHECK-LABEL: cos_v2f64:
476 ; CHECK: call $push[[L:[0-9]+]]=, cos
477 declare <2 x double> @llvm.cos.v2f64(<2 x double>)
478 define <2 x double> @cos_v2f64(<2 x double> %x) {
479 %v = call <2 x double> @llvm.cos.v2f64(<2 x double> %x)
483 ; CHECK-LABEL: powi_v2f64:
484 ; CHECK: call $push[[L:[0-9]+]]=, __powidf2
485 declare <2 x double> @llvm.powi.v2f64.i32(<2 x double>, i32)
486 define <2 x double> @powi_v2f64(<2 x double> %x, i32 %y) {
487 %v = call <2 x double> @llvm.powi.v2f64.i32(<2 x double> %x, i32 %y)
491 ; CHECK-LABEL: pow_v2f64:
492 ; CHECK: call $push[[L:[0-9]+]]=, pow
493 declare <2 x double> @llvm.pow.v2f64(<2 x double>, <2 x double>)
494 define <2 x double> @pow_v2f64(<2 x double> %x, <2 x double> %y) {
495 %v = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> %y)
499 ; CHECK-LABEL: log_v2f64:
500 ; CHECK: call $push[[L:[0-9]+]]=, log
501 declare <2 x double> @llvm.log.v2f64(<2 x double>)
502 define <2 x double> @log_v2f64(<2 x double> %x) {
503 %v = call <2 x double> @llvm.log.v2f64(<2 x double> %x)
507 ; CHECK-LABEL: log2_v2f64:
508 ; CHECK: call $push[[L:[0-9]+]]=, log2
509 declare <2 x double> @llvm.log2.v2f64(<2 x double>)
510 define <2 x double> @log2_v2f64(<2 x double> %x) {
511 %v = call <2 x double> @llvm.log2.v2f64(<2 x double> %x)
515 ; CHECK-LABEL: log10_v2f64:
516 ; CHECK: call $push[[L:[0-9]+]]=, log10
517 declare <2 x double> @llvm.log10.v2f64(<2 x double>)
518 define <2 x double> @log10_v2f64(<2 x double> %x) {
519 %v = call <2 x double> @llvm.log10.v2f64(<2 x double> %x)
523 ; CHECK-LABEL: exp_v2f64:
524 ; CHECK: call $push[[L:[0-9]+]]=, exp
525 declare <2 x double> @llvm.exp.v2f64(<2 x double>)
526 define <2 x double> @exp_v2f64(<2 x double> %x) {
527 %v = call <2 x double> @llvm.exp.v2f64(<2 x double> %x)
531 ; CHECK-LABEL: exp2_v2f64:
532 ; CHECK: call $push[[L:[0-9]+]]=, exp2
533 declare <2 x double> @llvm.exp2.v2f64(<2 x double>)
534 define <2 x double> @exp2_v2f64(<2 x double> %x) {
535 %v = call <2 x double> @llvm.exp2.v2f64(<2 x double> %x)
539 ; CHECK-LABEL: rint_v2f64:
541 declare <2 x double> @llvm.rint.v2f64(<2 x double>)
542 define <2 x double> @rint_v2f64(<2 x double> %x) {
543 %v = call <2 x double> @llvm.rint.v2f64(<2 x double> %x)
547 ; CHECK-LABEL: round_v2f64:
548 ; CHECK: call $push[[L:[0-9]+]]=, round
549 declare <2 x double> @llvm.round.v2f64(<2 x double>)
550 define <2 x double> @round_v2f64(<2 x double> %x) {
551 %v = call <2 x double> @llvm.round.v2f64(<2 x double> %x)