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:
124 declare <8 x i16> @llvm.ctpop.v8i16(<8 x i16>)
125 define <8 x i16> @ctpop_v8i16(<8 x i16> %x) {
126 %v = call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %x)
130 ; CHECK-LABEL: sdiv_v8i16:
132 define <8 x i16> @sdiv_v8i16(<8 x i16> %x, <8 x i16> %y) {
133 %v = sdiv <8 x i16> %x, %y
137 ; CHECK-LABEL: udiv_v8i16:
139 define <8 x i16> @udiv_v8i16(<8 x i16> %x, <8 x i16> %y) {
140 %v = udiv <8 x i16> %x, %y
144 ; CHECK-LABEL: srem_v8i16:
146 define <8 x i16> @srem_v8i16(<8 x i16> %x, <8 x i16> %y) {
147 %v = srem <8 x i16> %x, %y
151 ; CHECK-LABEL: urem_v8i16:
153 define <8 x i16> @urem_v8i16(<8 x i16> %x, <8 x i16> %y) {
154 %v = urem <8 x i16> %x, %y
158 ; CHECK-LABEL: rotl_v8i16:
159 ; Note: expansion does not use i32.rotl
161 declare <8 x i16> @llvm.fshl.v8i16(<8 x i16>, <8 x i16>, <8 x i16>)
162 define <8 x i16> @rotl_v8i16(<8 x i16> %x, <8 x i16> %y) {
163 %v = call <8 x i16> @llvm.fshl.v8i16(<8 x i16> %x, <8 x i16> %x, <8 x i16> %y)
167 ; CHECK-LABEL: rotr_v8i16:
168 ; Note: expansion does not use i32.rotr
170 declare <8 x i16> @llvm.fshr.v8i16(<8 x i16>, <8 x i16>, <8 x i16>)
171 define <8 x i16> @rotr_v8i16(<8 x i16> %x, <8 x i16> %y) {
172 %v = call <8 x i16> @llvm.fshr.v8i16(<8 x i16> %x, <8 x i16> %x, <8 x i16> %y)
176 ; ==============================================================================
178 ; ==============================================================================
180 ; CHECK-LABEL: ctlz_v4i32:
182 declare <4 x i32> @llvm.ctlz.v4i32(<4 x i32>, i1)
183 define <4 x i32> @ctlz_v4i32(<4 x i32> %x) {
184 %v = call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %x, i1 false)
188 ; CHECK-LABEL: ctlz_v4i32_undef:
190 define <4 x i32> @ctlz_v4i32_undef(<4 x i32> %x) {
191 %v = call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %x, i1 true)
195 ; CHECK-LABEL: cttz_v4i32:
197 declare <4 x i32> @llvm.cttz.v4i32(<4 x i32>, i1)
198 define <4 x i32> @cttz_v4i32(<4 x i32> %x) {
199 %v = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %x, i1 false)
203 ; CHECK-LABEL: cttz_v4i32_undef:
205 define <4 x i32> @cttz_v4i32_undef(<4 x i32> %x) {
206 %v = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %x, i1 true)
210 ; CHECK-LABEL: ctpop_v4i32:
212 declare <4 x i32> @llvm.ctpop.v4i32(<4 x i32>)
213 define <4 x i32> @ctpop_v4i32(<4 x i32> %x) {
214 %v = call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %x)
218 ; CHECK-LABEL: sdiv_v4i32:
220 define <4 x i32> @sdiv_v4i32(<4 x i32> %x, <4 x i32> %y) {
221 %v = sdiv <4 x i32> %x, %y
225 ; CHECK-LABEL: udiv_v4i32:
227 define <4 x i32> @udiv_v4i32(<4 x i32> %x, <4 x i32> %y) {
228 %v = udiv <4 x i32> %x, %y
232 ; CHECK-LABEL: srem_v4i32:
234 define <4 x i32> @srem_v4i32(<4 x i32> %x, <4 x i32> %y) {
235 %v = srem <4 x i32> %x, %y
239 ; CHECK-LABEL: urem_v4i32:
241 define <4 x i32> @urem_v4i32(<4 x i32> %x, <4 x i32> %y) {
242 %v = urem <4 x i32> %x, %y
246 ; CHECK-LABEL: rotl_v4i32:
247 ; Note: expansion does not use i32.rotl
249 declare <4 x i32> @llvm.fshl.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
250 define <4 x i32> @rotl_v4i32(<4 x i32> %x, <4 x i32> %y) {
251 %v = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %x, <4 x i32> %x, <4 x i32> %y)
255 ; CHECK-LABEL: rotr_v4i32:
256 ; Note: expansion does not use i32.rotr
258 declare <4 x i32> @llvm.fshr.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
259 define <4 x i32> @rotr_v4i32(<4 x i32> %x, <4 x i32> %y) {
260 %v = call <4 x i32> @llvm.fshr.v4i32(<4 x i32> %x, <4 x i32> %x, <4 x i32> %y)
264 ; ==============================================================================
266 ; ==============================================================================
268 ; CHECK-LABEL: ctlz_v2i64:
270 declare <2 x i64> @llvm.ctlz.v2i64(<2 x i64>, i1)
271 define <2 x i64> @ctlz_v2i64(<2 x i64> %x) {
272 %v = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %x, i1 false)
276 ; CHECK-LABEL: ctlz_v2i64_undef:
278 define <2 x i64> @ctlz_v2i64_undef(<2 x i64> %x) {
279 %v = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %x, i1 true)
283 ; CHECK-LABEL: cttz_v2i64:
285 declare <2 x i64> @llvm.cttz.v2i64(<2 x i64>, i1)
286 define <2 x i64> @cttz_v2i64(<2 x i64> %x) {
287 %v = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %x, i1 false)
291 ; CHECK-LABEL: cttz_v2i64_undef:
293 define <2 x i64> @cttz_v2i64_undef(<2 x i64> %x) {
294 %v = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %x, i1 true)
298 ; CHECK-LABEL: ctpop_v2i64:
300 declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>)
301 define <2 x i64> @ctpop_v2i64(<2 x i64> %x) {
302 %v = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %x)
306 ; CHECK-LABEL: sdiv_v2i64:
308 define <2 x i64> @sdiv_v2i64(<2 x i64> %x, <2 x i64> %y) {
309 %v = sdiv <2 x i64> %x, %y
313 ; CHECK-LABEL: udiv_v2i64:
315 define <2 x i64> @udiv_v2i64(<2 x i64> %x, <2 x i64> %y) {
316 %v = udiv <2 x i64> %x, %y
320 ; CHECK-LABEL: srem_v2i64:
322 define <2 x i64> @srem_v2i64(<2 x i64> %x, <2 x i64> %y) {
323 %v = srem <2 x i64> %x, %y
327 ; CHECK-LABEL: urem_v2i64:
329 define <2 x i64> @urem_v2i64(<2 x i64> %x, <2 x i64> %y) {
330 %v = urem <2 x i64> %x, %y
334 ; CHECK-LABEL: rotl_v2i64:
335 ; Note: expansion does not use i64.rotl
337 declare <2 x i64> @llvm.fshl.v2i64(<2 x i64>, <2 x i64>, <2 x i64>)
338 define <2 x i64> @rotl_v2i64(<2 x i64> %x, <2 x i64> %y) {
339 %v = call <2 x i64> @llvm.fshl.v2i64(<2 x i64> %x, <2 x i64> %x, <2 x i64> %y)
343 ; CHECK-LABEL: rotr_v2i64:
344 ; Note: expansion does not use i64.rotr
346 declare <2 x i64> @llvm.fshr.v2i64(<2 x i64>, <2 x i64>, <2 x i64>)
347 define <2 x i64> @rotr_v2i64(<2 x i64> %x, <2 x i64> %y) {
348 %v = call <2 x i64> @llvm.fshr.v2i64(<2 x i64> %x, <2 x i64> %x, <2 x i64> %y)
352 ; ==============================================================================
354 ; ==============================================================================
356 ; CHECK-LABEL: copysign_v4f32:
357 ; CHECK: f32.copysign
358 declare <4 x float> @llvm.copysign.v4f32(<4 x float>, <4 x float>)
359 define <4 x float> @copysign_v4f32(<4 x float> %x, <4 x float> %y) {
360 %v = call <4 x float> @llvm.copysign.v4f32(<4 x float> %x, <4 x float> %y)
364 ; CHECK-LABEL: sin_v4f32:
365 ; CHECK: call $push[[L:[0-9]+]]=, sinf
366 declare <4 x float> @llvm.sin.v4f32(<4 x float>)
367 define <4 x float> @sin_v4f32(<4 x float> %x) {
368 %v = call <4 x float> @llvm.sin.v4f32(<4 x float> %x)
372 ; CHECK-LABEL: cos_v4f32:
373 ; CHECK: call $push[[L:[0-9]+]]=, cosf
374 declare <4 x float> @llvm.cos.v4f32(<4 x float>)
375 define <4 x float> @cos_v4f32(<4 x float> %x) {
376 %v = call <4 x float> @llvm.cos.v4f32(<4 x float> %x)
380 ; CHECK-LABEL: powi_v4f32:
381 ; CHECK: call $push[[L:[0-9]+]]=, __powisf2
382 declare <4 x float> @llvm.powi.v4f32.i32(<4 x float>, i32)
383 define <4 x float> @powi_v4f32(<4 x float> %x, i32 %y) {
384 %v = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> %x, i32 %y)
388 ; CHECK-LABEL: pow_v4f32:
389 ; CHECK: call $push[[L:[0-9]+]]=, powf
390 declare <4 x float> @llvm.pow.v4f32(<4 x float>, <4 x float>)
391 define <4 x float> @pow_v4f32(<4 x float> %x, <4 x float> %y) {
392 %v = call <4 x float> @llvm.pow.v4f32(<4 x float> %x, <4 x float> %y)
396 ; CHECK-LABEL: log_v4f32:
397 ; CHECK: call $push[[L:[0-9]+]]=, logf
398 declare <4 x float> @llvm.log.v4f32(<4 x float>)
399 define <4 x float> @log_v4f32(<4 x float> %x) {
400 %v = call <4 x float> @llvm.log.v4f32(<4 x float> %x)
404 ; CHECK-LABEL: log2_v4f32:
405 ; CHECK: call $push[[L:[0-9]+]]=, log2f
406 declare <4 x float> @llvm.log2.v4f32(<4 x float>)
407 define <4 x float> @log2_v4f32(<4 x float> %x) {
408 %v = call <4 x float> @llvm.log2.v4f32(<4 x float> %x)
412 ; CHECK-LABEL: log10_v4f32:
413 ; CHECK: call $push[[L:[0-9]+]]=, log10f
414 declare <4 x float> @llvm.log10.v4f32(<4 x float>)
415 define <4 x float> @log10_v4f32(<4 x float> %x) {
416 %v = call <4 x float> @llvm.log10.v4f32(<4 x float> %x)
420 ; CHECK-LABEL: exp_v4f32:
421 ; CHECK: call $push[[L:[0-9]+]]=, expf
422 declare <4 x float> @llvm.exp.v4f32(<4 x float>)
423 define <4 x float> @exp_v4f32(<4 x float> %x) {
424 %v = call <4 x float> @llvm.exp.v4f32(<4 x float> %x)
428 ; CHECK-LABEL: exp2_v4f32:
429 ; CHECK: call $push[[L:[0-9]+]]=, exp2f
430 declare <4 x float> @llvm.exp2.v4f32(<4 x float>)
431 define <4 x float> @exp2_v4f32(<4 x float> %x) {
432 %v = call <4 x float> @llvm.exp2.v4f32(<4 x float> %x)
436 ; CHECK-LABEL: round_v4f32:
437 ; CHECK: call $push[[L:[0-9]+]]=, roundf
438 declare <4 x float> @llvm.round.v4f32(<4 x float>)
439 define <4 x float> @round_v4f32(<4 x float> %x) {
440 %v = call <4 x float> @llvm.round.v4f32(<4 x float> %x)
444 ; ==============================================================================
446 ; ==============================================================================
448 ; CHECK-LABEL: copysign_v2f64:
449 ; CHECK: f64.copysign
450 declare <2 x double> @llvm.copysign.v2f64(<2 x double>, <2 x double>)
451 define <2 x double> @copysign_v2f64(<2 x double> %x, <2 x double> %y) {
452 %v = call <2 x double> @llvm.copysign.v2f64(<2 x double> %x, <2 x double> %y)
456 ; CHECK-LABEL: sin_v2f64:
457 ; CHECK: call $push[[L:[0-9]+]]=, sin
458 declare <2 x double> @llvm.sin.v2f64(<2 x double>)
459 define <2 x double> @sin_v2f64(<2 x double> %x) {
460 %v = call <2 x double> @llvm.sin.v2f64(<2 x double> %x)
464 ; CHECK-LABEL: cos_v2f64:
465 ; CHECK: call $push[[L:[0-9]+]]=, cos
466 declare <2 x double> @llvm.cos.v2f64(<2 x double>)
467 define <2 x double> @cos_v2f64(<2 x double> %x) {
468 %v = call <2 x double> @llvm.cos.v2f64(<2 x double> %x)
472 ; CHECK-LABEL: powi_v2f64:
473 ; CHECK: call $push[[L:[0-9]+]]=, __powidf2
474 declare <2 x double> @llvm.powi.v2f64.i32(<2 x double>, i32)
475 define <2 x double> @powi_v2f64(<2 x double> %x, i32 %y) {
476 %v = call <2 x double> @llvm.powi.v2f64.i32(<2 x double> %x, i32 %y)
480 ; CHECK-LABEL: pow_v2f64:
481 ; CHECK: call $push[[L:[0-9]+]]=, pow
482 declare <2 x double> @llvm.pow.v2f64(<2 x double>, <2 x double>)
483 define <2 x double> @pow_v2f64(<2 x double> %x, <2 x double> %y) {
484 %v = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> %y)
488 ; CHECK-LABEL: log_v2f64:
489 ; CHECK: call $push[[L:[0-9]+]]=, log
490 declare <2 x double> @llvm.log.v2f64(<2 x double>)
491 define <2 x double> @log_v2f64(<2 x double> %x) {
492 %v = call <2 x double> @llvm.log.v2f64(<2 x double> %x)
496 ; CHECK-LABEL: log2_v2f64:
497 ; CHECK: call $push[[L:[0-9]+]]=, log2
498 declare <2 x double> @llvm.log2.v2f64(<2 x double>)
499 define <2 x double> @log2_v2f64(<2 x double> %x) {
500 %v = call <2 x double> @llvm.log2.v2f64(<2 x double> %x)
504 ; CHECK-LABEL: log10_v2f64:
505 ; CHECK: call $push[[L:[0-9]+]]=, log10
506 declare <2 x double> @llvm.log10.v2f64(<2 x double>)
507 define <2 x double> @log10_v2f64(<2 x double> %x) {
508 %v = call <2 x double> @llvm.log10.v2f64(<2 x double> %x)
512 ; CHECK-LABEL: exp_v2f64:
513 ; CHECK: call $push[[L:[0-9]+]]=, exp
514 declare <2 x double> @llvm.exp.v2f64(<2 x double>)
515 define <2 x double> @exp_v2f64(<2 x double> %x) {
516 %v = call <2 x double> @llvm.exp.v2f64(<2 x double> %x)
520 ; CHECK-LABEL: exp2_v2f64:
521 ; CHECK: call $push[[L:[0-9]+]]=, exp2
522 declare <2 x double> @llvm.exp2.v2f64(<2 x double>)
523 define <2 x double> @exp2_v2f64(<2 x double> %x) {
524 %v = call <2 x double> @llvm.exp2.v2f64(<2 x double> %x)
528 ; CHECK-LABEL: round_v2f64:
529 ; CHECK: call $push[[L:[0-9]+]]=, round
530 declare <2 x double> @llvm.round.v2f64(<2 x double>)
531 define <2 x double> @round_v2f64(<2 x double> %x) {
532 %v = call <2 x double> @llvm.round.v2f64(<2 x double> %x)