1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O3 \
3 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
4 ; RUN: < %s | FileCheck %s
5 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O3 \
6 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr -mattr=-mma \
7 ; RUN: < %s | FileCheck %s --check-prefix=CHECK-NOMMA
8 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O3 \
9 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
10 ; RUN: < %s | FileCheck %s --check-prefix=CHECK-BE
11 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O3 \
12 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr -mattr=-mma \
13 ; RUN: < %s | FileCheck %s --check-prefix=CHECK-BE-NOMMA
15 ; This test also checks that the paired vector intrinsics are available even
16 ; when MMA is disabled.
19 declare <256 x i1> @llvm.ppc.vsx.assemble.pair(<16 x i8>, <16 x i8>)
20 define void @ass_pair(<256 x i1>* %ptr, <16 x i8> %vc) {
21 ; CHECK-LABEL: ass_pair:
22 ; CHECK: # %bb.0: # %entry
23 ; CHECK-NEXT: vmr v3, v2
24 ; CHECK-NEXT: stxv v2, 16(r3)
25 ; CHECK-NEXT: stxv v3, 0(r3)
28 ; CHECK-NOMMA-LABEL: ass_pair:
29 ; CHECK-NOMMA: # %bb.0: # %entry
30 ; CHECK-NOMMA-NEXT: vmr v3, v2
31 ; CHECK-NOMMA-NEXT: stxv v2, 16(r3)
32 ; CHECK-NOMMA-NEXT: stxv v3, 0(r3)
33 ; CHECK-NOMMA-NEXT: blr
35 ; CHECK-BE-LABEL: ass_pair:
36 ; CHECK-BE: # %bb.0: # %entry
37 ; CHECK-BE-NEXT: vmr v3, v2
38 ; CHECK-BE-NEXT: stxv v2, 16(r3)
39 ; CHECK-BE-NEXT: stxv v2, 0(r3)
42 ; CHECK-BE-NOMMA-LABEL: ass_pair:
43 ; CHECK-BE-NOMMA: # %bb.0: # %entry
44 ; CHECK-BE-NOMMA-NEXT: vmr v3, v2
45 ; CHECK-BE-NOMMA-NEXT: stxv v2, 16(r3)
46 ; CHECK-BE-NOMMA-NEXT: stxv v2, 0(r3)
47 ; CHECK-BE-NOMMA-NEXT: blr
49 %0 = tail call <256 x i1> @llvm.ppc.vsx.assemble.pair(<16 x i8> %vc, <16 x i8> %vc)
50 store <256 x i1> %0, <256 x i1>* %ptr, align 32
55 declare { <16 x i8>, <16 x i8> } @llvm.ppc.vsx.disassemble.pair(<256 x i1>)
56 define void @disass_pair(<256 x i1>* %ptr1, <16 x i8>* %ptr2, <16 x i8>* %ptr3) {
57 ; CHECK-LABEL: disass_pair:
58 ; CHECK: # %bb.0: # %entry
59 ; CHECK-NEXT: lxv v3, 0(r3)
60 ; CHECK-NEXT: lxv v2, 16(r3)
61 ; CHECK-NEXT: stxv v3, 0(r4)
62 ; CHECK-NEXT: stxv v2, 0(r5)
65 ; CHECK-NOMMA-LABEL: disass_pair:
66 ; CHECK-NOMMA: # %bb.0: # %entry
67 ; CHECK-NOMMA-NEXT: lxv v3, 0(r3)
68 ; CHECK-NOMMA-NEXT: lxv v2, 16(r3)
69 ; CHECK-NOMMA-NEXT: stxv v3, 0(r4)
70 ; CHECK-NOMMA-NEXT: stxv v2, 0(r5)
71 ; CHECK-NOMMA-NEXT: blr
73 ; CHECK-BE-LABEL: disass_pair:
74 ; CHECK-BE: # %bb.0: # %entry
75 ; CHECK-BE-NEXT: lxv v3, 16(r3)
76 ; CHECK-BE-NEXT: lxv v2, 0(r3)
77 ; CHECK-BE-NEXT: stxv v2, 0(r4)
78 ; CHECK-BE-NEXT: stxv v3, 0(r5)
81 ; CHECK-BE-NOMMA-LABEL: disass_pair:
82 ; CHECK-BE-NOMMA: # %bb.0: # %entry
83 ; CHECK-BE-NOMMA-NEXT: lxv v3, 16(r3)
84 ; CHECK-BE-NOMMA-NEXT: lxv v2, 0(r3)
85 ; CHECK-BE-NOMMA-NEXT: stxv v2, 0(r4)
86 ; CHECK-BE-NOMMA-NEXT: stxv v3, 0(r5)
87 ; CHECK-BE-NOMMA-NEXT: blr
89 %0 = load <256 x i1>, <256 x i1>* %ptr1, align 32
90 %1 = tail call { <16 x i8>, <16 x i8> } @llvm.ppc.vsx.disassemble.pair(<256 x i1> %0)
91 %2 = extractvalue { <16 x i8>, <16 x i8> } %1, 0
92 %3 = extractvalue { <16 x i8>, <16 x i8> } %1, 1
93 store <16 x i8> %2, <16 x i8>* %ptr2, align 16
94 store <16 x i8> %3, <16 x i8>* %ptr3, align 16
98 define void @test_ldst_1(<256 x i1>* %vpp, <256 x i1>* %vp2) {
99 ; CHECK-LABEL: test_ldst_1:
100 ; CHECK: # %bb.0: # %entry
101 ; CHECK-NEXT: lxvp vsp34, 0(r3)
102 ; CHECK-NEXT: stxvp vsp34, 0(r4)
105 ; CHECK-NOMMA-LABEL: test_ldst_1:
106 ; CHECK-NOMMA: # %bb.0: # %entry
107 ; CHECK-NOMMA-NEXT: lxvp vsp34, 0(r3)
108 ; CHECK-NOMMA-NEXT: stxvp vsp34, 0(r4)
109 ; CHECK-NOMMA-NEXT: blr
111 ; CHECK-BE-LABEL: test_ldst_1:
112 ; CHECK-BE: # %bb.0: # %entry
113 ; CHECK-BE-NEXT: lxvp vsp34, 0(r3)
114 ; CHECK-BE-NEXT: stxvp vsp34, 0(r4)
117 ; CHECK-BE-NOMMA-LABEL: test_ldst_1:
118 ; CHECK-BE-NOMMA: # %bb.0: # %entry
119 ; CHECK-BE-NOMMA-NEXT: lxvp vsp34, 0(r3)
120 ; CHECK-BE-NOMMA-NEXT: stxvp vsp34, 0(r4)
121 ; CHECK-BE-NOMMA-NEXT: blr
123 %0 = bitcast <256 x i1>* %vpp to i8*
124 %1 = tail call <256 x i1> @llvm.ppc.vsx.lxvp(i8* %0)
125 %2 = bitcast <256 x i1>* %vp2 to i8*
126 tail call void @llvm.ppc.vsx.stxvp(<256 x i1> %1, i8* %2)
130 declare <256 x i1> @llvm.ppc.vsx.lxvp(i8*)
131 declare void @llvm.ppc.vsx.stxvp(<256 x i1>, i8*)
133 define void @test_ldst_2(<256 x i1>* %vpp, i64 %offset, <256 x i1>* %vp2) {
134 ; CHECK-LABEL: test_ldst_2:
135 ; CHECK: # %bb.0: # %entry
136 ; CHECK-NEXT: lxvpx vsp34, r3, r4
137 ; CHECK-NEXT: stxvpx vsp34, r5, r4
140 ; CHECK-NOMMA-LABEL: test_ldst_2:
141 ; CHECK-NOMMA: # %bb.0: # %entry
142 ; CHECK-NOMMA-NEXT: lxvpx vsp34, r3, r4
143 ; CHECK-NOMMA-NEXT: stxvpx vsp34, r5, r4
144 ; CHECK-NOMMA-NEXT: blr
146 ; CHECK-BE-LABEL: test_ldst_2:
147 ; CHECK-BE: # %bb.0: # %entry
148 ; CHECK-BE-NEXT: lxvpx vsp34, r3, r4
149 ; CHECK-BE-NEXT: stxvpx vsp34, r5, r4
152 ; CHECK-BE-NOMMA-LABEL: test_ldst_2:
153 ; CHECK-BE-NOMMA: # %bb.0: # %entry
154 ; CHECK-BE-NOMMA-NEXT: lxvpx vsp34, r3, r4
155 ; CHECK-BE-NOMMA-NEXT: stxvpx vsp34, r5, r4
156 ; CHECK-BE-NOMMA-NEXT: blr
158 %0 = bitcast <256 x i1>* %vpp to i8*
159 %1 = getelementptr i8, i8* %0, i64 %offset
160 %2 = tail call <256 x i1> @llvm.ppc.vsx.lxvp(i8* %1)
161 %3 = bitcast <256 x i1>* %vp2 to i8*
162 %4 = getelementptr i8, i8* %3, i64 %offset
163 tail call void @llvm.ppc.vsx.stxvp(<256 x i1> %2, i8* %4)
167 define void @test_ldst_3(<256 x i1>* %vpp, <256 x i1>* %vp2) {
168 ; CHECK-LABEL: test_ldst_3:
169 ; CHECK: # %bb.0: # %entry
170 ; CHECK-NEXT: li r5, 18
171 ; CHECK-NEXT: lxvpx vsp34, r3, r5
172 ; CHECK-NEXT: stxvpx vsp34, r4, r5
175 ; CHECK-NOMMA-LABEL: test_ldst_3:
176 ; CHECK-NOMMA: # %bb.0: # %entry
177 ; CHECK-NOMMA-NEXT: li r5, 18
178 ; CHECK-NOMMA-NEXT: lxvpx vsp34, r3, r5
179 ; CHECK-NOMMA-NEXT: stxvpx vsp34, r4, r5
180 ; CHECK-NOMMA-NEXT: blr
182 ; CHECK-BE-LABEL: test_ldst_3:
183 ; CHECK-BE: # %bb.0: # %entry
184 ; CHECK-BE-NEXT: li r5, 18
185 ; CHECK-BE-NEXT: lxvpx vsp34, r3, r5
186 ; CHECK-BE-NEXT: stxvpx vsp34, r4, r5
189 ; CHECK-BE-NOMMA-LABEL: test_ldst_3:
190 ; CHECK-BE-NOMMA: # %bb.0: # %entry
191 ; CHECK-BE-NOMMA-NEXT: li r5, 18
192 ; CHECK-BE-NOMMA-NEXT: lxvpx vsp34, r3, r5
193 ; CHECK-BE-NOMMA-NEXT: stxvpx vsp34, r4, r5
194 ; CHECK-BE-NOMMA-NEXT: blr
196 %0 = bitcast <256 x i1>* %vpp to i8*
197 %1 = getelementptr i8, i8* %0, i64 18
198 %2 = tail call <256 x i1> @llvm.ppc.vsx.lxvp(i8* %1)
199 %3 = bitcast <256 x i1>* %vp2 to i8*
200 %4 = getelementptr i8, i8* %3, i64 18
201 tail call void @llvm.ppc.vsx.stxvp(<256 x i1> %2, i8* %4)
205 define void @test_ldst_4(<256 x i1>* %vpp, <256 x i1>* %vp2) {
206 ; CHECK-LABEL: test_ldst_4:
207 ; CHECK: # %bb.0: # %entry
208 ; CHECK-NEXT: li r5, 1
209 ; CHECK-NEXT: lxvpx vsp34, r3, r5
210 ; CHECK-NEXT: stxvpx vsp34, r4, r5
213 ; CHECK-NOMMA-LABEL: test_ldst_4:
214 ; CHECK-NOMMA: # %bb.0: # %entry
215 ; CHECK-NOMMA-NEXT: li r5, 1
216 ; CHECK-NOMMA-NEXT: lxvpx vsp34, r3, r5
217 ; CHECK-NOMMA-NEXT: stxvpx vsp34, r4, r5
218 ; CHECK-NOMMA-NEXT: blr
220 ; CHECK-BE-LABEL: test_ldst_4:
221 ; CHECK-BE: # %bb.0: # %entry
222 ; CHECK-BE-NEXT: li r5, 1
223 ; CHECK-BE-NEXT: lxvpx vsp34, r3, r5
224 ; CHECK-BE-NEXT: stxvpx vsp34, r4, r5
227 ; CHECK-BE-NOMMA-LABEL: test_ldst_4:
228 ; CHECK-BE-NOMMA: # %bb.0: # %entry
229 ; CHECK-BE-NOMMA-NEXT: li r5, 1
230 ; CHECK-BE-NOMMA-NEXT: lxvpx vsp34, r3, r5
231 ; CHECK-BE-NOMMA-NEXT: stxvpx vsp34, r4, r5
232 ; CHECK-BE-NOMMA-NEXT: blr
234 %0 = bitcast <256 x i1>* %vpp to i8*
235 %1 = getelementptr i8, i8* %0, i64 1
236 %2 = tail call <256 x i1> @llvm.ppc.vsx.lxvp(i8* %1)
237 %3 = bitcast <256 x i1>* %vp2 to i8*
238 %4 = getelementptr i8, i8* %3, i64 1
239 tail call void @llvm.ppc.vsx.stxvp(<256 x i1> %2, i8* %4)
243 define void @test_ldst_5(<256 x i1>* %vpp, <256 x i1>* %vp2) {
244 ; CHECK-LABEL: test_ldst_5:
245 ; CHECK: # %bb.0: # %entry
246 ; CHECK-NEXT: li r5, 42
247 ; CHECK-NEXT: lxvpx vsp34, r3, r5
248 ; CHECK-NEXT: stxvpx vsp34, r4, r5
251 ; CHECK-NOMMA-LABEL: test_ldst_5:
252 ; CHECK-NOMMA: # %bb.0: # %entry
253 ; CHECK-NOMMA-NEXT: li r5, 42
254 ; CHECK-NOMMA-NEXT: lxvpx vsp34, r3, r5
255 ; CHECK-NOMMA-NEXT: stxvpx vsp34, r4, r5
256 ; CHECK-NOMMA-NEXT: blr
258 ; CHECK-BE-LABEL: test_ldst_5:
259 ; CHECK-BE: # %bb.0: # %entry
260 ; CHECK-BE-NEXT: li r5, 42
261 ; CHECK-BE-NEXT: lxvpx vsp34, r3, r5
262 ; CHECK-BE-NEXT: stxvpx vsp34, r4, r5
265 ; CHECK-BE-NOMMA-LABEL: test_ldst_5:
266 ; CHECK-BE-NOMMA: # %bb.0: # %entry
267 ; CHECK-BE-NOMMA-NEXT: li r5, 42
268 ; CHECK-BE-NOMMA-NEXT: lxvpx vsp34, r3, r5
269 ; CHECK-BE-NOMMA-NEXT: stxvpx vsp34, r4, r5
270 ; CHECK-BE-NOMMA-NEXT: blr
272 %0 = bitcast <256 x i1>* %vpp to i8*
273 %1 = getelementptr i8, i8* %0, i64 42
274 %2 = tail call <256 x i1> @llvm.ppc.vsx.lxvp(i8* %1)
275 %3 = bitcast <256 x i1>* %vp2 to i8*
276 %4 = getelementptr i8, i8* %3, i64 42
277 tail call void @llvm.ppc.vsx.stxvp(<256 x i1> %2, i8* %4)
281 define void @test_ldst_6(<256 x i1>* %vpp, <256 x i1>* %vp2) {
282 ; CHECK-LABEL: test_ldst_6:
283 ; CHECK: # %bb.0: # %entry
284 ; CHECK-NEXT: lxvp vsp34, 4096(r3)
285 ; CHECK-NEXT: stxvp vsp34, 4096(r4)
288 ; CHECK-NOMMA-LABEL: test_ldst_6:
289 ; CHECK-NOMMA: # %bb.0: # %entry
290 ; CHECK-NOMMA-NEXT: lxvp vsp34, 4096(r3)
291 ; CHECK-NOMMA-NEXT: stxvp vsp34, 4096(r4)
292 ; CHECK-NOMMA-NEXT: blr
294 ; CHECK-BE-LABEL: test_ldst_6:
295 ; CHECK-BE: # %bb.0: # %entry
296 ; CHECK-BE-NEXT: lxvp vsp34, 4096(r3)
297 ; CHECK-BE-NEXT: stxvp vsp34, 4096(r4)
300 ; CHECK-BE-NOMMA-LABEL: test_ldst_6:
301 ; CHECK-BE-NOMMA: # %bb.0: # %entry
302 ; CHECK-BE-NOMMA-NEXT: lxvp vsp34, 4096(r3)
303 ; CHECK-BE-NOMMA-NEXT: stxvp vsp34, 4096(r4)
304 ; CHECK-BE-NOMMA-NEXT: blr
306 %0 = getelementptr <256 x i1>, <256 x i1>* %vpp, i64 128
307 %1 = bitcast <256 x i1>* %0 to i8*
308 %2 = tail call <256 x i1> @llvm.ppc.vsx.lxvp(i8* %1)
309 %3 = getelementptr <256 x i1>, <256 x i1>* %vp2, i64 128
310 %4 = bitcast <256 x i1>* %3 to i8*
311 tail call void @llvm.ppc.vsx.stxvp(<256 x i1> %2, i8* %4)
315 define void @test_ldst_7(<256 x i1>* %vpp, <256 x i1>* %vp2) {
316 ; FIXME: A prefixed load (plxvp) is expected here as the offset in this
317 ; test case is a constant that fits within 34-bits.
318 ; CHECK-LABEL: test_ldst_7:
319 ; CHECK: # %bb.0: # %entry
320 ; CHECK-NEXT: pli r5, 32799
321 ; CHECK-NEXT: lxvpx vsp34, r3, r5
322 ; CHECK-NEXT: stxvpx vsp34, r4, r5
325 ; CHECK-NOMMA-LABEL: test_ldst_7:
326 ; CHECK-NOMMA: # %bb.0: # %entry
327 ; CHECK-NOMMA-NEXT: pli r5, 32799
328 ; CHECK-NOMMA-NEXT: lxvpx vsp34, r3, r5
329 ; CHECK-NOMMA-NEXT: stxvpx vsp34, r4, r5
330 ; CHECK-NOMMA-NEXT: blr
332 ; CHECK-BE-LABEL: test_ldst_7:
333 ; CHECK-BE: # %bb.0: # %entry
334 ; CHECK-BE-NEXT: pli r5, 32799
335 ; CHECK-BE-NEXT: lxvpx vsp34, r3, r5
336 ; CHECK-BE-NEXT: stxvpx vsp34, r4, r5
339 ; CHECK-BE-NOMMA-LABEL: test_ldst_7:
340 ; CHECK-BE-NOMMA: # %bb.0: # %entry
341 ; CHECK-BE-NOMMA-NEXT: pli r5, 32799
342 ; CHECK-BE-NOMMA-NEXT: lxvpx vsp34, r3, r5
343 ; CHECK-BE-NOMMA-NEXT: stxvpx vsp34, r4, r5
344 ; CHECK-BE-NOMMA-NEXT: blr
346 %0 = bitcast <256 x i1>* %vpp to i8*
347 %1 = getelementptr i8, i8* %0, i64 32799
348 %2 = tail call <256 x i1> @llvm.ppc.vsx.lxvp(i8* %1)
349 %3 = bitcast <256 x i1>* %vp2 to i8*
350 %4 = getelementptr i8, i8* %3, i64 32799
351 tail call void @llvm.ppc.vsx.stxvp(<256 x i1> %2, i8* %4)