1 ; This test checks support for vector arithmetic.
3 ; RUN: %p2i -i %s --filetype=obj --disassemble -a -O2 \
5 ; RUN: %p2i -i %s --filetype=obj --disassemble -a -Om1 \
7 ; RUN: %p2i -i %s --filetype=obj --disassemble -a -O2 -mattr=sse4.1 \
8 ; RUN: | FileCheck --check-prefix=SSE41 %s
9 ; RUN: %p2i -i %s --filetype=obj --disassemble -a -Om1 -mattr=sse4.1 \
10 ; RUN: | FileCheck --check-prefix=SSE41 %s
12 define internal <4 x float> @test_fadd(<4 x float> %arg0, <4 x float> %arg1) {
14 %res = fadd <4 x float> %arg0, %arg1
16 ; CHECK-LABEL: test_fadd
20 define internal <4 x float> @test_fsub(<4 x float> %arg0, <4 x float> %arg1) {
22 %res = fsub <4 x float> %arg0, %arg1
24 ; CHECK-LABEL: test_fsub
28 define internal <4 x float> @test_fmul(<4 x float> %arg0, <4 x float> %arg1) {
30 %res = fmul <4 x float> %arg0, %arg1
32 ; CHECK-LABEL: test_fmul
36 define internal <4 x float> @test_fdiv(<4 x float> %arg0, <4 x float> %arg1) {
38 %res = fdiv <4 x float> %arg0, %arg1
40 ; CHECK-LABEL: test_fdiv
44 define internal <4 x float> @test_frem(<4 x float> %arg0, <4 x float> %arg1) {
46 %res = frem <4 x float> %arg0, %arg1
48 ; CHECK-LABEL: test_frem
55 define internal <16 x i8> @test_add_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
57 %res = add <16 x i8> %arg0, %arg1
59 ; CHECK-LABEL: test_add_v16i8
63 define internal <16 x i8> @test_and_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
65 %res = and <16 x i8> %arg0, %arg1
67 ; CHECK-LABEL: test_and_v16i8
71 define internal <16 x i8> @test_or_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
73 %res = or <16 x i8> %arg0, %arg1
75 ; CHECK-LABEL: test_or_v16i8
79 define internal <16 x i8> @test_xor_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
81 %res = xor <16 x i8> %arg0, %arg1
83 ; CHECK-LABEL: test_xor_v16i8
87 define internal <16 x i8> @test_sub_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
89 %res = sub <16 x i8> %arg0, %arg1
91 ; CHECK-LABEL: test_sub_v16i8
95 define internal <16 x i8> @test_mul_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
97 %res = mul <16 x i8> %arg0, %arg1
99 ; CHECK-LABEL: test_mul_v16i8
118 define internal <16 x i8> @test_shl_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
120 %res = shl <16 x i8> %arg0, %arg1
122 ; CHECK-LABEL: test_shl_v16i8
141 define internal <16 x i8> @test_lshr_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
143 %res = lshr <16 x i8> %arg0, %arg1
145 ; CHECK-LABEL: test_lshr_v16i8
164 define internal <16 x i8> @test_ashr_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
166 %res = ashr <16 x i8> %arg0, %arg1
168 ; CHECK-LABEL: test_ashr_v16i8
187 define internal <16 x i8> @test_udiv_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
189 %res = udiv <16 x i8> %arg0, %arg1
191 ; CHECK-LABEL: test_udiv_v16i8
210 define internal <16 x i8> @test_sdiv_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
212 %res = sdiv <16 x i8> %arg0, %arg1
214 ; CHECK-LABEL: test_sdiv_v16i8
233 define internal <16 x i8> @test_urem_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
235 %res = urem <16 x i8> %arg0, %arg1
237 ; CHECK-LABEL: test_urem_v16i8
256 define internal <16 x i8> @test_srem_v16i8(<16 x i8> %arg0, <16 x i8> %arg1) {
258 %res = srem <16 x i8> %arg0, %arg1
260 ; CHECK-LABEL: test_srem_v16i8
279 define internal <8 x i16> @test_add_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
281 %res = add <8 x i16> %arg0, %arg1
283 ; CHECK-LABEL: test_add_v8i16
287 define internal <8 x i16> @test_and_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
289 %res = and <8 x i16> %arg0, %arg1
291 ; CHECK-LABEL: test_and_v8i16
295 define internal <8 x i16> @test_or_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
297 %res = or <8 x i16> %arg0, %arg1
299 ; CHECK-LABEL: test_or_v8i16
303 define internal <8 x i16> @test_xor_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
305 %res = xor <8 x i16> %arg0, %arg1
307 ; CHECK-LABEL: test_xor_v8i16
311 define internal <8 x i16> @test_sub_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
313 %res = sub <8 x i16> %arg0, %arg1
315 ; CHECK-LABEL: test_sub_v8i16
319 define internal <8 x i16> @test_mul_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
321 %res = mul <8 x i16> %arg0, %arg1
323 ; CHECK-LABEL: test_mul_v8i16
327 define internal <8 x i16> @test_shl_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
329 %res = shl <8 x i16> %arg0, %arg1
331 ; CHECK-LABEL: test_shl_v8i16
342 define internal <8 x i16> @test_lshr_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
344 %res = lshr <8 x i16> %arg0, %arg1
346 ; CHECK-LABEL: test_lshr_v8i16
357 define internal <8 x i16> @test_ashr_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
359 %res = ashr <8 x i16> %arg0, %arg1
361 ; CHECK-LABEL: test_ashr_v8i16
372 define internal <8 x i16> @test_udiv_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
374 %res = udiv <8 x i16> %arg0, %arg1
376 ; CHECK-LABEL: test_udiv_v8i16
387 define internal <8 x i16> @test_sdiv_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
389 %res = sdiv <8 x i16> %arg0, %arg1
391 ; CHECK-LABEL: test_sdiv_v8i16
402 define internal <8 x i16> @test_urem_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
404 %res = urem <8 x i16> %arg0, %arg1
406 ; CHECK-LABEL: test_urem_v8i16
417 define internal <8 x i16> @test_srem_v8i16(<8 x i16> %arg0, <8 x i16> %arg1) {
419 %res = srem <8 x i16> %arg0, %arg1
421 ; CHECK-LABEL: test_srem_v8i16
432 define internal <4 x i32> @test_add_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
434 %res = add <4 x i32> %arg0, %arg1
436 ; CHECK-LABEL: test_add_v4i32
440 define internal <4 x i32> @test_and_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
442 %res = and <4 x i32> %arg0, %arg1
444 ; CHECK-LABEL: test_and_v4i32
448 define internal <4 x i32> @test_or_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
450 %res = or <4 x i32> %arg0, %arg1
452 ; CHECK-LABEL: test_or_v4i32
456 define internal <4 x i32> @test_xor_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
458 %res = xor <4 x i32> %arg0, %arg1
460 ; CHECK-LABEL: test_xor_v4i32
464 define internal <4 x i32> @test_sub_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
466 %res = sub <4 x i32> %arg0, %arg1
468 ; CHECK-LABEL: test_sub_v4i32
472 define internal <4 x i32> @test_mul_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
474 %res = mul <4 x i32> %arg0, %arg1
476 ; CHECK-LABEL: test_mul_v4i32
480 ; SSE41-LABEL: test_mul_v4i32
484 define internal <4 x i32> @test_shl_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
486 %res = shl <4 x i32> %arg0, %arg1
488 ; CHECK-LABEL: test_shl_v4i32
494 ; This line is to ensure that pmulld is generated in test_mul_v4i32 above.
495 ; SSE41-LABEL: test_shl_v4i32
498 define internal <4 x i32> @test_lshr_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
500 %res = lshr <4 x i32> %arg0, %arg1
502 ; CHECK-LABEL: test_lshr_v4i32
509 define internal <4 x i32> @test_ashr_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
511 %res = ashr <4 x i32> %arg0, %arg1
513 ; CHECK-LABEL: test_ashr_v4i32
520 define internal <4 x i32> @test_udiv_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
522 %res = udiv <4 x i32> %arg0, %arg1
524 ; CHECK-LABEL: test_udiv_v4i32
531 define internal <4 x i32> @test_sdiv_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
533 %res = sdiv <4 x i32> %arg0, %arg1
535 ; CHECK-LABEL: test_sdiv_v4i32
542 define internal <4 x i32> @test_urem_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
544 %res = urem <4 x i32> %arg0, %arg1
546 ; CHECK-LABEL: test_urem_v4i32
553 define internal <4 x i32> @test_srem_v4i32(<4 x i32> %arg0, <4 x i32> %arg1) {
555 %res = srem <4 x i32> %arg0, %arg1
557 ; CHECK-LABEL: test_srem_v4i32