1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
3 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
5 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
6 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
8 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-ibm-aix-xcoff \
9 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | \
12 ; This test case aims to test the vector multiply instructions on Power10.
13 ; This includes the low order and high order versions of vector multiply.
14 ; The low order version operates on doublewords, whereas the high order version
15 ; operates on signed and unsigned words and doublewords.
16 ; This file also includes 128 bit vector multiply instructions.
18 define <2 x i64> @test_vmulld(<2 x i64> %a, <2 x i64> %b) {
19 ; CHECK-LABEL: test_vmulld:
20 ; CHECK: # %bb.0: # %entry
21 ; CHECK-NEXT: vmulld v2, v3, v2
24 %mul = mul <2 x i64> %b, %a
28 define <2 x i64> @test_vmulhsd(<2 x i64> %a, <2 x i64> %b) {
29 ; CHECK-LABEL: test_vmulhsd:
30 ; CHECK: # %bb.0: # %entry
31 ; CHECK-NEXT: vmulhsd v2, v3, v2
34 %0 = sext <2 x i64> %a to <2 x i128>
35 %1 = sext <2 x i64> %b to <2 x i128>
36 %mul = mul <2 x i128> %1, %0
37 %shr = lshr <2 x i128> %mul, <i128 64, i128 64>
38 %tr = trunc <2 x i128> %shr to <2 x i64>
42 define <2 x i64> @test_vmulhud(<2 x i64> %a, <2 x i64> %b) {
43 ; CHECK-LABEL: test_vmulhud:
44 ; CHECK: # %bb.0: # %entry
45 ; CHECK-NEXT: vmulhud v2, v3, v2
48 %0 = zext <2 x i64> %a to <2 x i128>
49 %1 = zext <2 x i64> %b to <2 x i128>
50 %mul = mul <2 x i128> %1, %0
51 %shr = lshr <2 x i128> %mul, <i128 64, i128 64>
52 %tr = trunc <2 x i128> %shr to <2 x i64>
56 define <4 x i32> @test_vmulhsw(<4 x i32> %a, <4 x i32> %b) {
57 ; CHECK-LABEL: test_vmulhsw:
58 ; CHECK: # %bb.0: # %entry
59 ; CHECK-NEXT: vmulhsw v2, v3, v2
62 %0 = sext <4 x i32> %a to <4 x i64>
63 %1 = sext <4 x i32> %b to <4 x i64>
64 %mul = mul <4 x i64> %1, %0
65 %shr = lshr <4 x i64> %mul, <i64 32, i64 32, i64 32, i64 32>
66 %tr = trunc <4 x i64> %shr to <4 x i32>
70 define <4 x i32> @test_vmulhuw(<4 x i32> %a, <4 x i32> %b) {
71 ; CHECK-LABEL: test_vmulhuw:
72 ; CHECK: # %bb.0: # %entry
73 ; CHECK-NEXT: vmulhuw v2, v3, v2
76 %0 = zext <4 x i32> %a to <4 x i64>
77 %1 = zext <4 x i32> %b to <4 x i64>
78 %mul = mul <4 x i64> %1, %0
79 %shr = lshr <4 x i64> %mul, <i64 32, i64 32, i64 32, i64 32>
80 %tr = trunc <4 x i64> %shr to <4 x i32>
84 ; Test the vector multiply high intrinsics.
85 declare <4 x i32> @llvm.ppc.altivec.vmulhsw(<4 x i32>, <4 x i32>)
86 declare <4 x i32> @llvm.ppc.altivec.vmulhuw(<4 x i32>, <4 x i32>)
87 declare <2 x i64> @llvm.ppc.altivec.vmulhsd(<2 x i64>, <2 x i64>)
88 declare <2 x i64> @llvm.ppc.altivec.vmulhud(<2 x i64>, <2 x i64>)
90 define <4 x i32> @test_vmulhsw_intrinsic(<4 x i32> %a, <4 x i32> %b) {
91 ; CHECK-LABEL: test_vmulhsw_intrinsic:
92 ; CHECK: # %bb.0: # %entry
93 ; CHECK-NEXT: vmulhsw v2, v2, v3
96 %mulh = tail call <4 x i32> @llvm.ppc.altivec.vmulhsw(<4 x i32> %a, <4 x i32> %b)
100 define <4 x i32> @test_vmulhuw_intrinsic(<4 x i32> %a, <4 x i32> %b) {
101 ; CHECK-LABEL: test_vmulhuw_intrinsic:
102 ; CHECK: # %bb.0: # %entry
103 ; CHECK-NEXT: vmulhuw v2, v2, v3
106 %mulh = tail call <4 x i32> @llvm.ppc.altivec.vmulhuw(<4 x i32> %a, <4 x i32> %b)
110 define <2 x i64> @test_vmulhsd_intrinsic(<2 x i64> %a, <2 x i64> %b) {
111 ; CHECK-LABEL: test_vmulhsd_intrinsic:
112 ; CHECK: # %bb.0: # %entry
113 ; CHECK-NEXT: vmulhsd v2, v2, v3
116 %mulh = tail call <2 x i64> @llvm.ppc.altivec.vmulhsd(<2 x i64> %a, <2 x i64> %b)
120 define <2 x i64> @test_vmulhud_intrinsic(<2 x i64> %a, <2 x i64> %b) {
121 ; CHECK-LABEL: test_vmulhud_intrinsic:
122 ; CHECK: # %bb.0: # %entry
123 ; CHECK-NEXT: vmulhud v2, v2, v3
126 %mulh = tail call <2 x i64> @llvm.ppc.altivec.vmulhud(<2 x i64> %a, <2 x i64> %b)
130 declare <1 x i128> @llvm.ppc.altivec.vmuleud(<2 x i64>, <2 x i64>) nounwind readnone
131 declare <1 x i128> @llvm.ppc.altivec.vmuloud(<2 x i64>, <2 x i64>) nounwind readnone
132 declare <1 x i128> @llvm.ppc.altivec.vmulesd(<2 x i64>, <2 x i64>) nounwind readnone
133 declare <1 x i128> @llvm.ppc.altivec.vmulosd(<2 x i64>, <2 x i64>) nounwind readnone
134 declare <1 x i128> @llvm.ppc.altivec.vmsumcud(<2 x i64>, <2 x i64>, <1 x i128>) nounwind readnone
136 define <1 x i128> @test_vmuleud(<2 x i64> %x, <2 x i64> %y) nounwind readnone {
137 ; CHECK-LABEL: test_vmuleud:
139 ; CHECK-NEXT: vmuleud v2, v2, v3
141 %tmp = tail call <1 x i128> @llvm.ppc.altivec.vmuleud(<2 x i64> %x, <2 x i64> %y)
145 define <1 x i128> @test_vmuloud(<2 x i64> %x, <2 x i64> %y) nounwind readnone {
146 ; CHECK-LABEL: test_vmuloud:
148 ; CHECK-NEXT: vmuloud v2, v2, v3
150 %tmp = tail call <1 x i128> @llvm.ppc.altivec.vmuloud(<2 x i64> %x, <2 x i64> %y)
154 define <1 x i128> @test_vmulesd(<2 x i64> %x, <2 x i64> %y) nounwind readnone {
155 ; CHECK-LABEL: test_vmulesd:
157 ; CHECK-NEXT: vmulesd v2, v2, v3
159 %tmp = tail call <1 x i128> @llvm.ppc.altivec.vmulesd(<2 x i64> %x, <2 x i64> %y)
163 define <1 x i128> @test_vmulosd(<2 x i64> %x, <2 x i64> %y) nounwind readnone {
164 ; CHECK-LABEL: test_vmulosd:
166 ; CHECK-NEXT: vmulosd v2, v2, v3
168 %tmp = tail call <1 x i128> @llvm.ppc.altivec.vmulosd(<2 x i64> %x, <2 x i64> %y)
172 define <1 x i128> @test_vmsumcud(<2 x i64> %x, <2 x i64> %y, <1 x i128> %z) nounwind readnone {
173 ; CHECK-LABEL: test_vmsumcud:
175 ; CHECK-NEXT: vmsumcud v2, v2, v3, v4
177 %tmp = tail call <1 x i128> @llvm.ppc.altivec.vmsumcud(<2 x i64> %x, <2 x i64> %y, <1 x i128> %z)