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 \
4 ; RUN: -ppc-vsr-nums-as-vr < %s | FileCheck %s
5 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
6 ; RUN: -mcpu=pwr10 -ppc-asm-full-reg-names \
7 ; RUN: -ppc-vsr-nums-as-vr < %s | FileCheck %s --check-prefix=CHECK-BE
8 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
9 ; RUN: -mcpu=pwr9 -ppc-asm-full-reg-names \
10 ; RUN: -ppc-vsr-nums-as-vr < %s | FileCheck %s --check-prefix=CHECK-P9
11 ; RUN: llc -mcpu=pwr8 -verify-machineinstrs -ppc-vsr-nums-as-vr \
12 ; RUN: -ppc-asm-full-reg-names -mtriple=powerpc64-ibm-aix-xcoff < %s | \
13 ; RUN: FileCheck %s --check-prefixes=AIX-P8,AIX-P8-64
14 ; RUN: llc -mcpu=pwr8 -verify-machineinstrs -ppc-vsr-nums-as-vr \
15 ; RUN: -ppc-asm-full-reg-names -mtriple=powerpc-ibm-aix-xcoff < %s | \
16 ; RUN: FileCheck %s --check-prefixes=AIX-P8,AIX-P8-32
20 define <16 x i8> @testByte(<16 x i8> %a, i64 %b, i64 %idx) {
21 ; CHECK-LABEL: testByte:
22 ; CHECK: # %bb.0: # %entry
23 ; CHECK-NEXT: vinsbrx v2, r6, r5
26 ; CHECK-BE-LABEL: testByte:
27 ; CHECK-BE: # %bb.0: # %entry
28 ; CHECK-BE-NEXT: vinsblx v2, r6, r5
31 ; CHECK-P9-LABEL: testByte:
32 ; CHECK-P9: # %bb.0: # %entry
33 ; CHECK-P9-NEXT: addi r4, r1, -16
34 ; CHECK-P9-NEXT: clrldi r3, r6, 60
35 ; CHECK-P9-NEXT: stxv v2, -16(r1)
36 ; CHECK-P9-NEXT: stbx r5, r4, r3
37 ; CHECK-P9-NEXT: lxv v2, -16(r1)
40 ; AIX-P8-64-LABEL: testByte:
41 ; AIX-P8-64: # %bb.0: # %entry
42 ; AIX-P8-64-NEXT: clrldi r4, r4, 60
43 ; AIX-P8-64-NEXT: addi r5, r1, -16
44 ; AIX-P8-64-NEXT: stxvw4x v2, 0, r5
45 ; AIX-P8-64-NEXT: stbx r3, r5, r4
46 ; AIX-P8-64-NEXT: lxvw4x v2, 0, r5
49 ; AIX-P8-32-LABEL: testByte:
50 ; AIX-P8-32: # %bb.0: # %entry
51 ; AIX-P8-32-NEXT: clrlwi r3, r6, 28
52 ; AIX-P8-32-NEXT: addi r5, r1, -16
53 ; AIX-P8-32-NEXT: stxvw4x v2, 0, r5
54 ; AIX-P8-32-NEXT: stbx r4, r5, r3
55 ; AIX-P8-32-NEXT: lxvw4x v2, 0, r5
58 %conv = trunc i64 %b to i8
59 %vecins = insertelement <16 x i8> %a, i8 %conv, i64 %idx
65 define <8 x i16> @testHalf(<8 x i16> %a, i64 %b, i64 %idx) {
66 ; CHECK-LABEL: testHalf:
67 ; CHECK: # %bb.0: # %entry
68 ; CHECK-NEXT: slwi r3, r6, 1
69 ; CHECK-NEXT: vinshrx v2, r3, r5
72 ; CHECK-BE-LABEL: testHalf:
73 ; CHECK-BE: # %bb.0: # %entry
74 ; CHECK-BE-NEXT: slwi r3, r6, 1
75 ; CHECK-BE-NEXT: vinshlx v2, r3, r5
78 ; CHECK-P9-LABEL: testHalf:
79 ; CHECK-P9: # %bb.0: # %entry
80 ; CHECK-P9-NEXT: addi r4, r1, -16
81 ; CHECK-P9-NEXT: rlwinm r3, r6, 1, 28, 30
82 ; CHECK-P9-NEXT: stxv v2, -16(r1)
83 ; CHECK-P9-NEXT: sthx r5, r4, r3
84 ; CHECK-P9-NEXT: lxv v2, -16(r1)
87 ; AIX-P8-64-LABEL: testHalf:
88 ; AIX-P8-64: # %bb.0: # %entry
89 ; AIX-P8-64-NEXT: rlwinm r4, r4, 1, 28, 30
90 ; AIX-P8-64-NEXT: addi r5, r1, -16
91 ; AIX-P8-64-NEXT: stxvw4x v2, 0, r5
92 ; AIX-P8-64-NEXT: sthx r3, r5, r4
93 ; AIX-P8-64-NEXT: lxvw4x v2, 0, r5
96 ; AIX-P8-32-LABEL: testHalf:
97 ; AIX-P8-32: # %bb.0: # %entry
98 ; AIX-P8-32-NEXT: rlwinm r3, r6, 1, 28, 30
99 ; AIX-P8-32-NEXT: addi r5, r1, -16
100 ; AIX-P8-32-NEXT: stxvw4x v2, 0, r5
101 ; AIX-P8-32-NEXT: sthx r4, r5, r3
102 ; AIX-P8-32-NEXT: lxvw4x v2, 0, r5
103 ; AIX-P8-32-NEXT: blr
105 %conv = trunc i64 %b to i16
106 %vecins = insertelement <8 x i16> %a, i16 %conv, i64 %idx
107 ret <8 x i16> %vecins
112 define <4 x i32> @testWord(<4 x i32> %a, i64 %b, i64 %idx) {
113 ; CHECK-LABEL: testWord:
114 ; CHECK: # %bb.0: # %entry
115 ; CHECK-NEXT: slwi r3, r6, 2
116 ; CHECK-NEXT: vinswrx v2, r3, r5
119 ; CHECK-BE-LABEL: testWord:
120 ; CHECK-BE: # %bb.0: # %entry
121 ; CHECK-BE-NEXT: slwi r3, r6, 2
122 ; CHECK-BE-NEXT: vinswlx v2, r3, r5
125 ; CHECK-P9-LABEL: testWord:
126 ; CHECK-P9: # %bb.0: # %entry
127 ; CHECK-P9-NEXT: addi r4, r1, -16
128 ; CHECK-P9-NEXT: rlwinm r3, r6, 2, 28, 29
129 ; CHECK-P9-NEXT: stxv v2, -16(r1)
130 ; CHECK-P9-NEXT: stwx r5, r4, r3
131 ; CHECK-P9-NEXT: lxv v2, -16(r1)
134 ; AIX-P8-64-LABEL: testWord:
135 ; AIX-P8-64: # %bb.0: # %entry
136 ; AIX-P8-64-NEXT: rlwinm r4, r4, 2, 28, 29
137 ; AIX-P8-64-NEXT: addi r5, r1, -16
138 ; AIX-P8-64-NEXT: stxvw4x v2, 0, r5
139 ; AIX-P8-64-NEXT: stwx r3, r5, r4
140 ; AIX-P8-64-NEXT: lxvw4x v2, 0, r5
141 ; AIX-P8-64-NEXT: blr
143 ; AIX-P8-32-LABEL: testWord:
144 ; AIX-P8-32: # %bb.0: # %entry
145 ; AIX-P8-32-NEXT: rlwinm r3, r6, 2, 28, 29
146 ; AIX-P8-32-NEXT: addi r5, r1, -16
147 ; AIX-P8-32-NEXT: stxvw4x v2, 0, r5
148 ; AIX-P8-32-NEXT: stwx r4, r5, r3
149 ; AIX-P8-32-NEXT: lxvw4x v2, 0, r5
150 ; AIX-P8-32-NEXT: blr
152 %conv = trunc i64 %b to i32
153 %vecins = insertelement <4 x i32> %a, i32 %conv, i64 %idx
154 ret <4 x i32> %vecins
159 define <4 x i32> @testWordImm(<4 x i32> %a, i64 %b) {
160 ; CHECK-LABEL: testWordImm:
161 ; CHECK: # %bb.0: # %entry
162 ; CHECK-NEXT: vinsw v2, r5, 8
163 ; CHECK-NEXT: vinsw v2, r5, 0
166 ; CHECK-BE-LABEL: testWordImm:
167 ; CHECK-BE: # %bb.0: # %entry
168 ; CHECK-BE-NEXT: vinsw v2, r5, 4
169 ; CHECK-BE-NEXT: vinsw v2, r5, 12
172 ; CHECK-P9-LABEL: testWordImm:
173 ; CHECK-P9: # %bb.0: # %entry
174 ; CHECK-P9-NEXT: mtfprwz f0, r5
175 ; CHECK-P9-NEXT: xxinsertw v2, vs0, 4
176 ; CHECK-P9-NEXT: xxinsertw v2, vs0, 12
179 ; AIX-P8-64-LABEL: testWordImm:
180 ; AIX-P8-64: # %bb.0: # %entry
181 ; AIX-P8-64-NEXT: ld r4, L..C0(r2) # %const.0
182 ; AIX-P8-64-NEXT: mtvsrwz v4, r3
183 ; AIX-P8-64-NEXT: ld r3, L..C1(r2) # %const.1
184 ; AIX-P8-64-NEXT: lxvw4x v3, 0, r4
185 ; AIX-P8-64-NEXT: vperm v2, v2, v4, v3
186 ; AIX-P8-64-NEXT: lxvw4x v3, 0, r3
187 ; AIX-P8-64-NEXT: vperm v2, v2, v4, v3
188 ; AIX-P8-64-NEXT: blr
190 ; AIX-P8-32-LABEL: testWordImm:
191 ; AIX-P8-32: # %bb.0: # %entry
192 ; AIX-P8-32-NEXT: lwz r3, L..C0(r2) # %const.0
193 ; AIX-P8-32-NEXT: stw r4, -16(r1)
194 ; AIX-P8-32-NEXT: lxvw4x v3, 0, r3
195 ; AIX-P8-32-NEXT: addi r3, r1, -16
196 ; AIX-P8-32-NEXT: lxvw4x v4, 0, r3
197 ; AIX-P8-32-NEXT: lwz r3, L..C1(r2) # %const.1
198 ; AIX-P8-32-NEXT: vperm v2, v2, v4, v3
199 ; AIX-P8-32-NEXT: lxvw4x v3, 0, r3
200 ; AIX-P8-32-NEXT: vperm v2, v2, v4, v3
201 ; AIX-P8-32-NEXT: blr
203 %conv = trunc i64 %b to i32
204 %vecins = insertelement <4 x i32> %a, i32 %conv, i32 1
205 %vecins2 = insertelement <4 x i32> %vecins, i32 %conv, i32 3
206 ret <4 x i32> %vecins2
211 define <2 x i64> @testDoubleword(<2 x i64> %a, i64 %b, i64 %idx) {
212 ; CHECK-LABEL: testDoubleword:
213 ; CHECK: # %bb.0: # %entry
214 ; CHECK-NEXT: rlwinm r3, r6, 3, 0, 28
215 ; CHECK-NEXT: vinsdrx v2, r3, r5
218 ; CHECK-BE-LABEL: testDoubleword:
219 ; CHECK-BE: # %bb.0: # %entry
220 ; CHECK-BE-NEXT: rlwinm r3, r6, 3, 0, 28
221 ; CHECK-BE-NEXT: vinsdlx v2, r3, r5
224 ; CHECK-P9-LABEL: testDoubleword:
225 ; CHECK-P9: # %bb.0: # %entry
226 ; CHECK-P9-NEXT: addi r4, r1, -16
227 ; CHECK-P9-NEXT: rlwinm r3, r6, 3, 28, 28
228 ; CHECK-P9-NEXT: stxv v2, -16(r1)
229 ; CHECK-P9-NEXT: stdx r5, r4, r3
230 ; CHECK-P9-NEXT: lxv v2, -16(r1)
233 ; AIX-P8-64-LABEL: testDoubleword:
234 ; AIX-P8-64: # %bb.0: # %entry
235 ; AIX-P8-64-NEXT: rlwinm r4, r4, 3, 28, 28
236 ; AIX-P8-64-NEXT: addi r5, r1, -16
237 ; AIX-P8-64-NEXT: stxvd2x v2, 0, r5
238 ; AIX-P8-64-NEXT: stdx r3, r5, r4
239 ; AIX-P8-64-NEXT: lxvd2x v2, 0, r5
240 ; AIX-P8-64-NEXT: blr
242 ; AIX-P8-32-LABEL: testDoubleword:
243 ; AIX-P8-32: # %bb.0: # %entry
244 ; AIX-P8-32-NEXT: add r6, r6, r6
245 ; AIX-P8-32-NEXT: addi r5, r1, -32
246 ; AIX-P8-32-NEXT: rlwinm r7, r6, 2, 28, 29
247 ; AIX-P8-32-NEXT: stxvw4x v2, 0, r5
248 ; AIX-P8-32-NEXT: stwx r3, r5, r7
249 ; AIX-P8-32-NEXT: addi r3, r1, -16
250 ; AIX-P8-32-NEXT: lxvw4x vs0, 0, r5
251 ; AIX-P8-32-NEXT: addi r5, r6, 1
252 ; AIX-P8-32-NEXT: rlwinm r5, r5, 2, 28, 29
253 ; AIX-P8-32-NEXT: stxvw4x vs0, 0, r3
254 ; AIX-P8-32-NEXT: stwx r4, r3, r5
255 ; AIX-P8-32-NEXT: lxvw4x v2, 0, r3
256 ; AIX-P8-32-NEXT: blr
258 %vecins = insertelement <2 x i64> %a, i64 %b, i64 %idx
259 ret <2 x i64> %vecins
262 ; Doubleword immediate
264 define <2 x i64> @testDoublewordImm(<2 x i64> %a, i64 %b) {
265 ; CHECK-LABEL: testDoublewordImm:
266 ; CHECK: # %bb.0: # %entry
267 ; CHECK-NEXT: vinsd v2, r5, 0
270 ; CHECK-BE-LABEL: testDoublewordImm:
271 ; CHECK-BE: # %bb.0: # %entry
272 ; CHECK-BE-NEXT: vinsd v2, r5, 8
275 ; CHECK-P9-LABEL: testDoublewordImm:
276 ; CHECK-P9: # %bb.0: # %entry
277 ; CHECK-P9-NEXT: mtfprd f0, r5
278 ; CHECK-P9-NEXT: xxmrghd v2, v2, vs0
281 ; AIX-P8-64-LABEL: testDoublewordImm:
282 ; AIX-P8-64: # %bb.0: # %entry
283 ; AIX-P8-64-NEXT: mtfprd f0, r3
284 ; AIX-P8-64-NEXT: xxmrghd v2, v2, vs0
285 ; AIX-P8-64-NEXT: blr
287 ; AIX-P8-32-LABEL: testDoublewordImm:
288 ; AIX-P8-32: # %bb.0: # %entry
289 ; AIX-P8-32-NEXT: stw r3, -16(r1)
290 ; AIX-P8-32-NEXT: lwz r3, L..C2(r2) # %const.0
291 ; AIX-P8-32-NEXT: stw r4, -32(r1)
292 ; AIX-P8-32-NEXT: lxvw4x v3, 0, r3
293 ; AIX-P8-32-NEXT: addi r3, r1, -16
294 ; AIX-P8-32-NEXT: lxvw4x v4, 0, r3
295 ; AIX-P8-32-NEXT: lwz r3, L..C3(r2) # %const.1
296 ; AIX-P8-32-NEXT: vperm v2, v2, v4, v3
297 ; AIX-P8-32-NEXT: lxvw4x v3, 0, r3
298 ; AIX-P8-32-NEXT: addi r3, r1, -32
299 ; AIX-P8-32-NEXT: lxvw4x v4, 0, r3
300 ; AIX-P8-32-NEXT: vperm v2, v2, v4, v3
301 ; AIX-P8-32-NEXT: blr
303 %vecins = insertelement <2 x i64> %a, i64 %b, i32 1
304 ret <2 x i64> %vecins
307 define <2 x i64> @testDoublewordImm2(<2 x i64> %a, i64 %b) {
308 ; CHECK-LABEL: testDoublewordImm2:
309 ; CHECK: # %bb.0: # %entry
310 ; CHECK-NEXT: vinsd v2, r5, 8
313 ; CHECK-BE-LABEL: testDoublewordImm2:
314 ; CHECK-BE: # %bb.0: # %entry
315 ; CHECK-BE-NEXT: vinsd v2, r5, 0
318 ; CHECK-P9-LABEL: testDoublewordImm2:
319 ; CHECK-P9: # %bb.0: # %entry
320 ; CHECK-P9-NEXT: mtfprd f0, r5
321 ; CHECK-P9-NEXT: xxpermdi v2, vs0, v2, 1
324 ; AIX-P8-64-LABEL: testDoublewordImm2:
325 ; AIX-P8-64: # %bb.0: # %entry
326 ; AIX-P8-64-NEXT: mtfprd f0, r3
327 ; AIX-P8-64-NEXT: xxpermdi v2, vs0, v2, 1
328 ; AIX-P8-64-NEXT: blr
330 ; AIX-P8-32-LABEL: testDoublewordImm2:
331 ; AIX-P8-32: # %bb.0: # %entry
332 ; AIX-P8-32-NEXT: stw r3, -16(r1)
333 ; AIX-P8-32-NEXT: lwz r3, L..C4(r2) # %const.0
334 ; AIX-P8-32-NEXT: stw r4, -32(r1)
335 ; AIX-P8-32-NEXT: lxvw4x v3, 0, r3
336 ; AIX-P8-32-NEXT: addi r3, r1, -16
337 ; AIX-P8-32-NEXT: lxvw4x v4, 0, r3
338 ; AIX-P8-32-NEXT: lwz r3, L..C5(r2) # %const.1
339 ; AIX-P8-32-NEXT: vperm v2, v4, v2, v3
340 ; AIX-P8-32-NEXT: lxvw4x v3, 0, r3
341 ; AIX-P8-32-NEXT: addi r3, r1, -32
342 ; AIX-P8-32-NEXT: lxvw4x v4, 0, r3
343 ; AIX-P8-32-NEXT: vperm v2, v2, v4, v3
344 ; AIX-P8-32-NEXT: blr
346 %vecins = insertelement <2 x i64> %a, i64 %b, i32 0
347 ret <2 x i64> %vecins
352 define <4 x float> @testFloat1(<4 x float> %a, float %b, i32 zeroext %idx1) {
353 ; CHECK-LABEL: testFloat1:
354 ; CHECK: # %bb.0: # %entry
355 ; CHECK-NEXT: xscvdpspn v3, f1
356 ; CHECK-NEXT: slwi r3, r6, 2
357 ; CHECK-NEXT: vinswvrx v2, r3, v3
360 ; CHECK-BE-LABEL: testFloat1:
361 ; CHECK-BE: # %bb.0: # %entry
362 ; CHECK-BE-NEXT: xscvdpspn v3, f1
363 ; CHECK-BE-NEXT: slwi r3, r6, 2
364 ; CHECK-BE-NEXT: vinswvlx v2, r3, v3
367 ; CHECK-P9-LABEL: testFloat1:
368 ; CHECK-P9: # %bb.0: # %entry
369 ; CHECK-P9-NEXT: addi r4, r1, -16
370 ; CHECK-P9-NEXT: rlwinm r3, r6, 2, 28, 29
371 ; CHECK-P9-NEXT: stxv v2, -16(r1)
372 ; CHECK-P9-NEXT: stfsx f1, r4, r3
373 ; CHECK-P9-NEXT: lxv v2, -16(r1)
376 ; AIX-P8-LABEL: testFloat1:
377 ; AIX-P8: # %bb.0: # %entry
378 ; AIX-P8-NEXT: rlwinm r3, r4, 2, 28, 29
379 ; AIX-P8-NEXT: addi r4, r1, -16
380 ; AIX-P8-NEXT: stxvw4x v2, 0, r4
381 ; AIX-P8-NEXT: stfsx f1, r4, r3
382 ; AIX-P8-NEXT: lxvw4x v2, 0, r4
385 %vecins = insertelement <4 x float> %a, float %b, i32 %idx1
386 ret <4 x float> %vecins
389 define <4 x float> @testFloat2(<4 x float> %a, ptr %b, i32 zeroext %idx1, i32 zeroext %idx2) {
390 ; CHECK-LABEL: testFloat2:
391 ; CHECK: # %bb.0: # %entry
392 ; CHECK-NEXT: lwz r3, 0(r5)
393 ; CHECK-NEXT: slwi r4, r6, 2
394 ; CHECK-NEXT: vinswrx v2, r4, r3
395 ; CHECK-NEXT: lwz r3, 1(r5)
396 ; CHECK-NEXT: slwi r4, r7, 2
397 ; CHECK-NEXT: vinswrx v2, r4, r3
400 ; CHECK-BE-LABEL: testFloat2:
401 ; CHECK-BE: # %bb.0: # %entry
402 ; CHECK-BE-NEXT: lwz r3, 0(r5)
403 ; CHECK-BE-NEXT: slwi r4, r6, 2
404 ; CHECK-BE-NEXT: vinswlx v2, r4, r3
405 ; CHECK-BE-NEXT: lwz r3, 1(r5)
406 ; CHECK-BE-NEXT: slwi r4, r7, 2
407 ; CHECK-BE-NEXT: vinswlx v2, r4, r3
410 ; CHECK-P9-LABEL: testFloat2:
411 ; CHECK-P9: # %bb.0: # %entry
412 ; CHECK-P9-NEXT: rlwinm r4, r6, 2, 28, 29
413 ; CHECK-P9-NEXT: lwz r6, 0(r5)
414 ; CHECK-P9-NEXT: rlwinm r3, r7, 2, 28, 29
415 ; CHECK-P9-NEXT: addi r7, r1, -16
416 ; CHECK-P9-NEXT: stxv v2, -16(r1)
417 ; CHECK-P9-NEXT: stwx r6, r7, r4
418 ; CHECK-P9-NEXT: lxv vs0, -16(r1)
419 ; CHECK-P9-NEXT: lwz r4, 1(r5)
420 ; CHECK-P9-NEXT: addi r5, r1, -32
421 ; CHECK-P9-NEXT: stxv vs0, -32(r1)
422 ; CHECK-P9-NEXT: stwx r4, r5, r3
423 ; CHECK-P9-NEXT: lxv v2, -32(r1)
426 ; AIX-P8-LABEL: testFloat2:
427 ; AIX-P8: # %bb.0: # %entry
428 ; AIX-P8-NEXT: lwz r6, 0(r3)
429 ; AIX-P8-NEXT: rlwinm r4, r4, 2, 28, 29
430 ; AIX-P8-NEXT: addi r7, r1, -32
431 ; AIX-P8-NEXT: stxvw4x v2, 0, r7
432 ; AIX-P8-NEXT: rlwinm r5, r5, 2, 28, 29
433 ; AIX-P8-NEXT: stwx r6, r7, r4
434 ; AIX-P8-NEXT: addi r4, r1, -16
435 ; AIX-P8-NEXT: lxvw4x vs0, 0, r7
436 ; AIX-P8-NEXT: lwz r3, 1(r3)
437 ; AIX-P8-NEXT: stxvw4x vs0, 0, r4
438 ; AIX-P8-NEXT: stwx r3, r4, r5
439 ; AIX-P8-NEXT: lxvw4x v2, 0, r4
442 %add.ptr1 = getelementptr inbounds i8, ptr %b, i64 1
443 %0 = load float, ptr %b, align 4
444 %vecins = insertelement <4 x float> %a, float %0, i32 %idx1
445 %1 = load float, ptr %add.ptr1, align 4
446 %vecins2 = insertelement <4 x float> %vecins, float %1, i32 %idx2
447 ret <4 x float> %vecins2
450 define <4 x float> @testFloat3(<4 x float> %a, ptr %b, i32 zeroext %idx1, i32 zeroext %idx2) {
451 ; CHECK-LABEL: testFloat3:
452 ; CHECK: # %bb.0: # %entry
453 ; CHECK-NEXT: plwz r3, 65536(r5), 0
454 ; CHECK-NEXT: slwi r4, r6, 2
455 ; CHECK-NEXT: vinswrx v2, r4, r3
456 ; CHECK-NEXT: li r3, 1
457 ; CHECK-NEXT: slwi r4, r7, 2
458 ; CHECK-NEXT: rldic r3, r3, 36, 27
459 ; CHECK-NEXT: lwzx r3, r5, r3
460 ; CHECK-NEXT: vinswrx v2, r4, r3
463 ; CHECK-BE-LABEL: testFloat3:
464 ; CHECK-BE: # %bb.0: # %entry
465 ; CHECK-BE-NEXT: plwz r3, 65536(r5), 0
466 ; CHECK-BE-NEXT: slwi r4, r6, 2
467 ; CHECK-BE-NEXT: vinswlx v2, r4, r3
468 ; CHECK-BE-NEXT: li r3, 1
469 ; CHECK-BE-NEXT: slwi r4, r7, 2
470 ; CHECK-BE-NEXT: rldic r3, r3, 36, 27
471 ; CHECK-BE-NEXT: lwzx r3, r5, r3
472 ; CHECK-BE-NEXT: vinswlx v2, r4, r3
475 ; CHECK-P9-LABEL: testFloat3:
476 ; CHECK-P9: # %bb.0: # %entry
477 ; CHECK-P9-NEXT: rlwinm r4, r6, 2, 28, 29
478 ; CHECK-P9-NEXT: lis r6, 1
479 ; CHECK-P9-NEXT: rlwinm r3, r7, 2, 28, 29
480 ; CHECK-P9-NEXT: addi r7, r1, -16
481 ; CHECK-P9-NEXT: lwzx r6, r5, r6
482 ; CHECK-P9-NEXT: stxv v2, -16(r1)
483 ; CHECK-P9-NEXT: stwx r6, r7, r4
484 ; CHECK-P9-NEXT: li r4, 1
485 ; CHECK-P9-NEXT: lxv vs0, -16(r1)
486 ; CHECK-P9-NEXT: rldic r4, r4, 36, 27
487 ; CHECK-P9-NEXT: lwzx r4, r5, r4
488 ; CHECK-P9-NEXT: addi r5, r1, -32
489 ; CHECK-P9-NEXT: stxv vs0, -32(r1)
490 ; CHECK-P9-NEXT: stwx r4, r5, r3
491 ; CHECK-P9-NEXT: lxv v2, -32(r1)
494 ; AIX-P8-64-LABEL: testFloat3:
495 ; AIX-P8-64: # %bb.0: # %entry
496 ; AIX-P8-64-NEXT: lis r6, 1
497 ; AIX-P8-64-NEXT: rlwinm r4, r4, 2, 28, 29
498 ; AIX-P8-64-NEXT: addi r7, r1, -32
499 ; AIX-P8-64-NEXT: rlwinm r5, r5, 2, 28, 29
500 ; AIX-P8-64-NEXT: lwzx r6, r3, r6
501 ; AIX-P8-64-NEXT: stxvw4x v2, 0, r7
502 ; AIX-P8-64-NEXT: stwx r6, r7, r4
503 ; AIX-P8-64-NEXT: li r4, 1
504 ; AIX-P8-64-NEXT: lxvw4x vs0, 0, r7
505 ; AIX-P8-64-NEXT: rldic r4, r4, 36, 27
506 ; AIX-P8-64-NEXT: lwzx r3, r3, r4
507 ; AIX-P8-64-NEXT: addi r4, r1, -16
508 ; AIX-P8-64-NEXT: stxvw4x vs0, 0, r4
509 ; AIX-P8-64-NEXT: stwx r3, r4, r5
510 ; AIX-P8-64-NEXT: lxvw4x v2, 0, r4
511 ; AIX-P8-64-NEXT: blr
513 ; AIX-P8-32-LABEL: testFloat3:
514 ; AIX-P8-32: # %bb.0: # %entry
515 ; AIX-P8-32-NEXT: lis r6, 1
516 ; AIX-P8-32-NEXT: rlwinm r4, r4, 2, 28, 29
517 ; AIX-P8-32-NEXT: addi r7, r1, -32
518 ; AIX-P8-32-NEXT: rlwinm r5, r5, 2, 28, 29
519 ; AIX-P8-32-NEXT: lwzx r6, r3, r6
520 ; AIX-P8-32-NEXT: stxvw4x v2, 0, r7
521 ; AIX-P8-32-NEXT: stwx r6, r7, r4
522 ; AIX-P8-32-NEXT: addi r4, r1, -16
523 ; AIX-P8-32-NEXT: lxvw4x vs0, 0, r7
524 ; AIX-P8-32-NEXT: lwz r3, 0(r3)
525 ; AIX-P8-32-NEXT: stxvw4x vs0, 0, r4
526 ; AIX-P8-32-NEXT: stwx r3, r4, r5
527 ; AIX-P8-32-NEXT: lxvw4x v2, 0, r4
528 ; AIX-P8-32-NEXT: blr
530 %add.ptr = getelementptr inbounds i8, ptr %b, i64 65536
531 %add.ptr1 = getelementptr inbounds i8, ptr %b, i64 68719476736
532 %0 = load float, ptr %add.ptr, align 4
533 %vecins = insertelement <4 x float> %a, float %0, i32 %idx1
534 %1 = load float, ptr %add.ptr1, align 4
535 %vecins2 = insertelement <4 x float> %vecins, float %1, i32 %idx2
536 ret <4 x float> %vecins2
541 define <4 x float> @testFloatImm1(<4 x float> %a, float %b) {
542 ; CHECK-LABEL: testFloatImm1:
543 ; CHECK: # %bb.0: # %entry
544 ; CHECK-NEXT: xscvdpspn vs0, f1
545 ; CHECK-NEXT: xxinsertw v2, vs0, 12
546 ; CHECK-NEXT: xxinsertw v2, vs0, 4
549 ; CHECK-BE-LABEL: testFloatImm1:
550 ; CHECK-BE: # %bb.0: # %entry
551 ; CHECK-BE-NEXT: xscvdpspn vs0, f1
552 ; CHECK-BE-NEXT: xxinsertw v2, vs0, 0
553 ; CHECK-BE-NEXT: xxinsertw v2, vs0, 8
556 ; CHECK-P9-LABEL: testFloatImm1:
557 ; CHECK-P9: # %bb.0: # %entry
558 ; CHECK-P9-NEXT: xscvdpspn vs0, f1
559 ; CHECK-P9-NEXT: xxinsertw v2, vs0, 0
560 ; CHECK-P9-NEXT: xxinsertw v2, vs0, 8
563 ; AIX-P8-64-LABEL: testFloatImm1:
564 ; AIX-P8-64: # %bb.0: # %entry
565 ; AIX-P8-64-NEXT: ld r3, L..C2(r2) # %const.0
566 ; AIX-P8-64-NEXT: xscvdpspn v4, f1
567 ; AIX-P8-64-NEXT: lxvw4x v3, 0, r3
568 ; AIX-P8-64-NEXT: ld r3, L..C3(r2) # %const.1
569 ; AIX-P8-64-NEXT: vperm v2, v4, v2, v3
570 ; AIX-P8-64-NEXT: lxvw4x v3, 0, r3
571 ; AIX-P8-64-NEXT: vperm v2, v2, v4, v3
572 ; AIX-P8-64-NEXT: blr
574 ; AIX-P8-32-LABEL: testFloatImm1:
575 ; AIX-P8-32: # %bb.0: # %entry
576 ; AIX-P8-32-NEXT: lwz r3, L..C6(r2) # %const.0
577 ; AIX-P8-32-NEXT: xscvdpspn v4, f1
578 ; AIX-P8-32-NEXT: lxvw4x v3, 0, r3
579 ; AIX-P8-32-NEXT: lwz r3, L..C7(r2) # %const.1
580 ; AIX-P8-32-NEXT: vperm v2, v4, v2, v3
581 ; AIX-P8-32-NEXT: lxvw4x v3, 0, r3
582 ; AIX-P8-32-NEXT: vperm v2, v2, v4, v3
583 ; AIX-P8-32-NEXT: blr
585 %vecins = insertelement <4 x float> %a, float %b, i32 0
586 %vecins1 = insertelement <4 x float> %vecins, float %b, i32 2
587 ret <4 x float> %vecins1
590 define <4 x float> @testFloatImm2(<4 x float> %a, ptr %b) {
591 ; CHECK-LABEL: testFloatImm2:
592 ; CHECK: # %bb.0: # %entry
593 ; CHECK-NEXT: lwz r3, 0(r5)
594 ; CHECK-NEXT: vinsw v2, r3, 12
595 ; CHECK-NEXT: lwz r3, 4(r5)
596 ; CHECK-NEXT: vinsw v2, r3, 4
599 ; CHECK-BE-LABEL: testFloatImm2:
600 ; CHECK-BE: # %bb.0: # %entry
601 ; CHECK-BE-NEXT: lwz r3, 0(r5)
602 ; CHECK-BE-NEXT: vinsw v2, r3, 0
603 ; CHECK-BE-NEXT: lwz r3, 4(r5)
604 ; CHECK-BE-NEXT: vinsw v2, r3, 8
607 ; CHECK-P9-LABEL: testFloatImm2:
608 ; CHECK-P9: # %bb.0: # %entry
609 ; CHECK-P9-NEXT: lwz r3, 0(r5)
610 ; CHECK-P9-NEXT: mtfprwz f0, r3
611 ; CHECK-P9-NEXT: lwz r3, 4(r5)
612 ; CHECK-P9-NEXT: xxinsertw v2, vs0, 0
613 ; CHECK-P9-NEXT: mtfprwz f0, r3
614 ; CHECK-P9-NEXT: xxinsertw v2, vs0, 8
617 ; AIX-P8-64-LABEL: testFloatImm2:
618 ; AIX-P8-64: # %bb.0: # %entry
619 ; AIX-P8-64-NEXT: ld r4, L..C4(r2) # %const.0
620 ; AIX-P8-64-NEXT: lxsiwzx v4, 0, r3
621 ; AIX-P8-64-NEXT: lxvw4x v3, 0, r4
622 ; AIX-P8-64-NEXT: li r4, 4
623 ; AIX-P8-64-NEXT: vperm v2, v4, v2, v3
624 ; AIX-P8-64-NEXT: lxsiwzx v3, r3, r4
625 ; AIX-P8-64-NEXT: ld r3, L..C5(r2) # %const.1
626 ; AIX-P8-64-NEXT: lxvw4x v4, 0, r3
627 ; AIX-P8-64-NEXT: vperm v2, v2, v3, v4
628 ; AIX-P8-64-NEXT: blr
630 ; AIX-P8-32-LABEL: testFloatImm2:
631 ; AIX-P8-32: # %bb.0: # %entry
632 ; AIX-P8-32-NEXT: lwz r4, L..C8(r2) # %const.0
633 ; AIX-P8-32-NEXT: lxsiwzx v4, 0, r3
634 ; AIX-P8-32-NEXT: lxvw4x v3, 0, r4
635 ; AIX-P8-32-NEXT: li r4, 4
636 ; AIX-P8-32-NEXT: vperm v2, v4, v2, v3
637 ; AIX-P8-32-NEXT: lxsiwzx v3, r3, r4
638 ; AIX-P8-32-NEXT: lwz r3, L..C9(r2) # %const.1
639 ; AIX-P8-32-NEXT: lxvw4x v4, 0, r3
640 ; AIX-P8-32-NEXT: vperm v2, v2, v3, v4
641 ; AIX-P8-32-NEXT: blr
643 %add.ptr1 = getelementptr inbounds i32, ptr %b, i64 1
644 %0 = load float, ptr %b, align 4
645 %vecins = insertelement <4 x float> %a, float %0, i32 0
646 %1 = load float, ptr %add.ptr1, align 4
647 %vecins2 = insertelement <4 x float> %vecins, float %1, i32 2
648 ret <4 x float> %vecins2
651 define <4 x float> @testFloatImm3(<4 x float> %a, ptr %b) {
652 ; CHECK-LABEL: testFloatImm3:
653 ; CHECK: # %bb.0: # %entry
654 ; CHECK-NEXT: plwz r3, 262144(r5), 0
655 ; CHECK-NEXT: vinsw v2, r3, 12
656 ; CHECK-NEXT: li r3, 1
657 ; CHECK-NEXT: rldic r3, r3, 38, 25
658 ; CHECK-NEXT: lwzx r3, r5, r3
659 ; CHECK-NEXT: vinsw v2, r3, 4
662 ; CHECK-BE-LABEL: testFloatImm3:
663 ; CHECK-BE: # %bb.0: # %entry
664 ; CHECK-BE-NEXT: plwz r3, 262144(r5), 0
665 ; CHECK-BE-NEXT: vinsw v2, r3, 0
666 ; CHECK-BE-NEXT: li r3, 1
667 ; CHECK-BE-NEXT: rldic r3, r3, 38, 25
668 ; CHECK-BE-NEXT: lwzx r3, r5, r3
669 ; CHECK-BE-NEXT: vinsw v2, r3, 8
672 ; CHECK-P9-LABEL: testFloatImm3:
673 ; CHECK-P9: # %bb.0: # %entry
674 ; CHECK-P9-NEXT: lis r3, 4
675 ; CHECK-P9-NEXT: lwzx r3, r5, r3
676 ; CHECK-P9-NEXT: mtfprwz f0, r3
677 ; CHECK-P9-NEXT: li r3, 1
678 ; CHECK-P9-NEXT: rldic r3, r3, 38, 25
679 ; CHECK-P9-NEXT: xxinsertw v2, vs0, 0
680 ; CHECK-P9-NEXT: lwzx r3, r5, r3
681 ; CHECK-P9-NEXT: mtfprwz f0, r3
682 ; CHECK-P9-NEXT: xxinsertw v2, vs0, 8
685 ; AIX-P8-64-LABEL: testFloatImm3:
686 ; AIX-P8-64: # %bb.0: # %entry
687 ; AIX-P8-64-NEXT: lis r4, 4
688 ; AIX-P8-64-NEXT: lxsiwzx v3, r3, r4
689 ; AIX-P8-64-NEXT: ld r4, L..C6(r2) # %const.0
690 ; AIX-P8-64-NEXT: lxvw4x v4, 0, r4
691 ; AIX-P8-64-NEXT: li r4, 1
692 ; AIX-P8-64-NEXT: rldic r4, r4, 38, 25
693 ; AIX-P8-64-NEXT: vperm v2, v3, v2, v4
694 ; AIX-P8-64-NEXT: lxsiwzx v3, r3, r4
695 ; AIX-P8-64-NEXT: ld r3, L..C7(r2) # %const.1
696 ; AIX-P8-64-NEXT: lxvw4x v4, 0, r3
697 ; AIX-P8-64-NEXT: vperm v2, v2, v3, v4
698 ; AIX-P8-64-NEXT: blr
700 ; AIX-P8-32-LABEL: testFloatImm3:
701 ; AIX-P8-32: # %bb.0: # %entry
702 ; AIX-P8-32-NEXT: lis r4, 4
703 ; AIX-P8-32-NEXT: lxsiwzx v3, r3, r4
704 ; AIX-P8-32-NEXT: lwz r4, L..C10(r2) # %const.0
705 ; AIX-P8-32-NEXT: lxvw4x v4, 0, r4
706 ; AIX-P8-32-NEXT: lwz r4, L..C11(r2) # %const.1
707 ; AIX-P8-32-NEXT: vperm v2, v3, v2, v4
708 ; AIX-P8-32-NEXT: lxvw4x v3, 0, r4
709 ; AIX-P8-32-NEXT: lxsiwzx v4, 0, r3
710 ; AIX-P8-32-NEXT: vperm v2, v2, v4, v3
711 ; AIX-P8-32-NEXT: blr
713 %add.ptr = getelementptr inbounds i32, ptr %b, i64 65536
714 %add.ptr1 = getelementptr inbounds i32, ptr %b, i64 68719476736
715 %0 = load float, ptr %add.ptr, align 4
716 %vecins = insertelement <4 x float> %a, float %0, i32 0
717 %1 = load float, ptr %add.ptr1, align 4
718 %vecins2 = insertelement <4 x float> %vecins, float %1, i32 2
719 ret <4 x float> %vecins2
724 define <2 x double> @testDouble1(<2 x double> %a, double %b, i32 zeroext %idx1) {
725 ; CHECK-LABEL: testDouble1:
726 ; CHECK: # %bb.0: # %entry
727 ; CHECK-NEXT: mffprd r3, f1
728 ; CHECK-NEXT: rlwinm r4, r6, 3, 0, 28
729 ; CHECK-NEXT: vinsdrx v2, r4, r3
732 ; CHECK-BE-LABEL: testDouble1:
733 ; CHECK-BE: # %bb.0: # %entry
734 ; CHECK-BE-NEXT: mffprd r3, f1
735 ; CHECK-BE-NEXT: rlwinm r4, r6, 3, 0, 28
736 ; CHECK-BE-NEXT: vinsdlx v2, r4, r3
739 ; CHECK-P9-LABEL: testDouble1:
740 ; CHECK-P9: # %bb.0: # %entry
741 ; CHECK-P9-NEXT: addi r4, r1, -16
742 ; CHECK-P9-NEXT: rlwinm r3, r6, 3, 28, 28
743 ; CHECK-P9-NEXT: stxv v2, -16(r1)
744 ; CHECK-P9-NEXT: stfdx f1, r4, r3
745 ; CHECK-P9-NEXT: lxv v2, -16(r1)
748 ; AIX-P8-64-LABEL: testDouble1:
749 ; AIX-P8-64: # %bb.0: # %entry
750 ; AIX-P8-64-NEXT: rlwinm r3, r4, 3, 28, 28
751 ; AIX-P8-64-NEXT: addi r4, r1, -16
752 ; AIX-P8-64-NEXT: stxvd2x v2, 0, r4
753 ; AIX-P8-64-NEXT: stfdx f1, r4, r3
754 ; AIX-P8-64-NEXT: lxvd2x v2, 0, r4
755 ; AIX-P8-64-NEXT: blr
757 ; AIX-P8-32-LABEL: testDouble1:
758 ; AIX-P8-32: # %bb.0: # %entry
759 ; AIX-P8-32-NEXT: rlwinm r3, r5, 3, 28, 28
760 ; AIX-P8-32-NEXT: addi r4, r1, -16
761 ; AIX-P8-32-NEXT: stxvd2x v2, 0, r4
762 ; AIX-P8-32-NEXT: stfdx f1, r4, r3
763 ; AIX-P8-32-NEXT: lxvd2x v2, 0, r4
764 ; AIX-P8-32-NEXT: blr
766 %vecins = insertelement <2 x double> %a, double %b, i32 %idx1
767 ret <2 x double> %vecins
770 define <2 x double> @testDouble2(<2 x double> %a, ptr %b, i32 zeroext %idx1, i32 zeroext %idx2) {
771 ; CHECK-LABEL: testDouble2:
772 ; CHECK: # %bb.0: # %entry
773 ; CHECK-NEXT: ld r3, 0(r5)
774 ; CHECK-NEXT: rlwinm r4, r6, 3, 0, 28
775 ; CHECK-NEXT: vinsdrx v2, r4, r3
776 ; CHECK-NEXT: pld r3, 1(r5), 0
777 ; CHECK-NEXT: rlwinm r4, r7, 3, 0, 28
778 ; CHECK-NEXT: vinsdrx v2, r4, r3
781 ; CHECK-BE-LABEL: testDouble2:
782 ; CHECK-BE: # %bb.0: # %entry
783 ; CHECK-BE-NEXT: ld r3, 0(r5)
784 ; CHECK-BE-NEXT: rlwinm r4, r6, 3, 0, 28
785 ; CHECK-BE-NEXT: vinsdlx v2, r4, r3
786 ; CHECK-BE-NEXT: pld r3, 1(r5), 0
787 ; CHECK-BE-NEXT: rlwinm r4, r7, 3, 0, 28
788 ; CHECK-BE-NEXT: vinsdlx v2, r4, r3
791 ; CHECK-P9-LABEL: testDouble2:
792 ; CHECK-P9: # %bb.0: # %entry
793 ; CHECK-P9-NEXT: rlwinm r4, r6, 3, 28, 28
794 ; CHECK-P9-NEXT: ld r6, 0(r5)
795 ; CHECK-P9-NEXT: rlwinm r3, r7, 3, 28, 28
796 ; CHECK-P9-NEXT: addi r7, r1, -32
797 ; CHECK-P9-NEXT: stxv v2, -32(r1)
798 ; CHECK-P9-NEXT: stdx r6, r7, r4
799 ; CHECK-P9-NEXT: li r4, 1
800 ; CHECK-P9-NEXT: lxv vs0, -32(r1)
801 ; CHECK-P9-NEXT: ldx r4, r5, r4
802 ; CHECK-P9-NEXT: addi r5, r1, -16
803 ; CHECK-P9-NEXT: stxv vs0, -16(r1)
804 ; CHECK-P9-NEXT: stdx r4, r5, r3
805 ; CHECK-P9-NEXT: lxv v2, -16(r1)
808 ; AIX-P8-64-LABEL: testDouble2:
809 ; AIX-P8-64: # %bb.0: # %entry
810 ; AIX-P8-64-NEXT: ld r6, 0(r3)
811 ; AIX-P8-64-NEXT: rlwinm r4, r4, 3, 28, 28
812 ; AIX-P8-64-NEXT: addi r7, r1, -32
813 ; AIX-P8-64-NEXT: stxvd2x v2, 0, r7
814 ; AIX-P8-64-NEXT: rlwinm r5, r5, 3, 28, 28
815 ; AIX-P8-64-NEXT: stdx r6, r7, r4
816 ; AIX-P8-64-NEXT: li r4, 1
817 ; AIX-P8-64-NEXT: lxvd2x vs0, 0, r7
818 ; AIX-P8-64-NEXT: ldx r3, r3, r4
819 ; AIX-P8-64-NEXT: addi r4, r1, -16
820 ; AIX-P8-64-NEXT: stxvd2x vs0, 0, r4
821 ; AIX-P8-64-NEXT: stdx r3, r4, r5
822 ; AIX-P8-64-NEXT: lxvd2x v2, 0, r4
823 ; AIX-P8-64-NEXT: blr
825 ; AIX-P8-32-LABEL: testDouble2:
826 ; AIX-P8-32: # %bb.0: # %entry
827 ; AIX-P8-32-NEXT: lfd f0, 0(r3)
828 ; AIX-P8-32-NEXT: rlwinm r4, r4, 3, 28, 28
829 ; AIX-P8-32-NEXT: addi r6, r1, -32
830 ; AIX-P8-32-NEXT: rlwinm r5, r5, 3, 28, 28
831 ; AIX-P8-32-NEXT: stxvd2x v2, 0, r6
832 ; AIX-P8-32-NEXT: stfdx f0, r6, r4
833 ; AIX-P8-32-NEXT: lxvd2x vs0, 0, r6
834 ; AIX-P8-32-NEXT: lfd f1, 1(r3)
835 ; AIX-P8-32-NEXT: addi r3, r1, -16
836 ; AIX-P8-32-NEXT: stxvd2x vs0, 0, r3
837 ; AIX-P8-32-NEXT: stfdx f1, r3, r5
838 ; AIX-P8-32-NEXT: lxvd2x v2, 0, r3
839 ; AIX-P8-32-NEXT: blr
841 %add.ptr1 = getelementptr inbounds i8, ptr %b, i64 1
842 %0 = load double, ptr %b, align 8
843 %vecins = insertelement <2 x double> %a, double %0, i32 %idx1
844 %1 = load double, ptr %add.ptr1, align 8
845 %vecins2 = insertelement <2 x double> %vecins, double %1, i32 %idx2
846 ret <2 x double> %vecins2
849 define <2 x double> @testDouble3(<2 x double> %a, ptr %b, i32 zeroext %idx1, i32 zeroext %idx2) {
850 ; CHECK-LABEL: testDouble3:
851 ; CHECK: # %bb.0: # %entry
852 ; CHECK-NEXT: pld r3, 65536(r5), 0
853 ; CHECK-NEXT: rlwinm r4, r6, 3, 0, 28
854 ; CHECK-NEXT: vinsdrx v2, r4, r3
855 ; CHECK-NEXT: li r3, 1
856 ; CHECK-NEXT: rlwinm r4, r7, 3, 0, 28
857 ; CHECK-NEXT: rldic r3, r3, 36, 27
858 ; CHECK-NEXT: ldx r3, r5, r3
859 ; CHECK-NEXT: vinsdrx v2, r4, r3
862 ; CHECK-BE-LABEL: testDouble3:
863 ; CHECK-BE: # %bb.0: # %entry
864 ; CHECK-BE-NEXT: pld r3, 65536(r5), 0
865 ; CHECK-BE-NEXT: rlwinm r4, r6, 3, 0, 28
866 ; CHECK-BE-NEXT: vinsdlx v2, r4, r3
867 ; CHECK-BE-NEXT: li r3, 1
868 ; CHECK-BE-NEXT: rlwinm r4, r7, 3, 0, 28
869 ; CHECK-BE-NEXT: rldic r3, r3, 36, 27
870 ; CHECK-BE-NEXT: ldx r3, r5, r3
871 ; CHECK-BE-NEXT: vinsdlx v2, r4, r3
874 ; CHECK-P9-LABEL: testDouble3:
875 ; CHECK-P9: # %bb.0: # %entry
876 ; CHECK-P9-NEXT: rlwinm r4, r6, 3, 28, 28
877 ; CHECK-P9-NEXT: lis r6, 1
878 ; CHECK-P9-NEXT: rlwinm r3, r7, 3, 28, 28
879 ; CHECK-P9-NEXT: addi r7, r1, -32
880 ; CHECK-P9-NEXT: ldx r6, r5, r6
881 ; CHECK-P9-NEXT: stxv v2, -32(r1)
882 ; CHECK-P9-NEXT: stdx r6, r7, r4
883 ; CHECK-P9-NEXT: li r4, 1
884 ; CHECK-P9-NEXT: lxv vs0, -32(r1)
885 ; CHECK-P9-NEXT: rldic r4, r4, 36, 27
886 ; CHECK-P9-NEXT: ldx r4, r5, r4
887 ; CHECK-P9-NEXT: addi r5, r1, -16
888 ; CHECK-P9-NEXT: stxv vs0, -16(r1)
889 ; CHECK-P9-NEXT: stdx r4, r5, r3
890 ; CHECK-P9-NEXT: lxv v2, -16(r1)
893 ; AIX-P8-64-LABEL: testDouble3:
894 ; AIX-P8-64: # %bb.0: # %entry
895 ; AIX-P8-64-NEXT: lis r6, 1
896 ; AIX-P8-64-NEXT: rlwinm r4, r4, 3, 28, 28
897 ; AIX-P8-64-NEXT: addi r7, r1, -32
898 ; AIX-P8-64-NEXT: rlwinm r5, r5, 3, 28, 28
899 ; AIX-P8-64-NEXT: ldx r6, r3, r6
900 ; AIX-P8-64-NEXT: stxvd2x v2, 0, r7
901 ; AIX-P8-64-NEXT: stdx r6, r7, r4
902 ; AIX-P8-64-NEXT: li r4, 1
903 ; AIX-P8-64-NEXT: lxvd2x vs0, 0, r7
904 ; AIX-P8-64-NEXT: rldic r4, r4, 36, 27
905 ; AIX-P8-64-NEXT: ldx r3, r3, r4
906 ; AIX-P8-64-NEXT: addi r4, r1, -16
907 ; AIX-P8-64-NEXT: stxvd2x vs0, 0, r4
908 ; AIX-P8-64-NEXT: stdx r3, r4, r5
909 ; AIX-P8-64-NEXT: lxvd2x v2, 0, r4
910 ; AIX-P8-64-NEXT: blr
912 ; AIX-P8-32-LABEL: testDouble3:
913 ; AIX-P8-32: # %bb.0: # %entry
914 ; AIX-P8-32-NEXT: lis r6, 1
915 ; AIX-P8-32-NEXT: rlwinm r4, r4, 3, 28, 28
916 ; AIX-P8-32-NEXT: rlwinm r5, r5, 3, 28, 28
917 ; AIX-P8-32-NEXT: lfdx f0, r3, r6
918 ; AIX-P8-32-NEXT: addi r6, r1, -32
919 ; AIX-P8-32-NEXT: stxvd2x v2, 0, r6
920 ; AIX-P8-32-NEXT: stfdx f0, r6, r4
921 ; AIX-P8-32-NEXT: lxvd2x vs0, 0, r6
922 ; AIX-P8-32-NEXT: lfd f1, 0(r3)
923 ; AIX-P8-32-NEXT: addi r3, r1, -16
924 ; AIX-P8-32-NEXT: stxvd2x vs0, 0, r3
925 ; AIX-P8-32-NEXT: stfdx f1, r3, r5
926 ; AIX-P8-32-NEXT: lxvd2x v2, 0, r3
927 ; AIX-P8-32-NEXT: blr
929 %add.ptr = getelementptr inbounds i8, ptr %b, i64 65536
930 %add.ptr1 = getelementptr inbounds i8, ptr %b, i64 68719476736
931 %0 = load double, ptr %add.ptr, align 8
932 %vecins = insertelement <2 x double> %a, double %0, i32 %idx1
933 %1 = load double, ptr %add.ptr1, align 8
934 %vecins2 = insertelement <2 x double> %vecins, double %1, i32 %idx2
935 ret <2 x double> %vecins2
940 define <2 x double> @testDoubleImm1(<2 x double> %a, double %b) {
941 ; CHECK-LABEL: testDoubleImm1:
942 ; CHECK: # %bb.0: # %entry
943 ; CHECK-NEXT: xxmrghd v2, v2, vs1
946 ; CHECK-BE-LABEL: testDoubleImm1:
947 ; CHECK-BE: # %bb.0: # %entry
948 ; CHECK-BE-NEXT: xxpermdi v2, vs1, v2, 1
951 ; CHECK-P9-LABEL: testDoubleImm1:
952 ; CHECK-P9: # %bb.0: # %entry
953 ; CHECK-P9-NEXT: xxpermdi v2, vs1, v2, 1
956 ; AIX-P8-LABEL: testDoubleImm1:
957 ; AIX-P8: # %bb.0: # %entry
958 ; AIX-P8-NEXT: xxpermdi v2, vs1, v2, 1
961 %vecins = insertelement <2 x double> %a, double %b, i32 0
962 ret <2 x double> %vecins
965 define <2 x double> @testDoubleImm2(<2 x double> %a, ptr %b) {
966 ; CHECK-LABEL: testDoubleImm2:
967 ; CHECK: # %bb.0: # %entry
968 ; CHECK-NEXT: lfd f0, 0(r5)
969 ; CHECK-NEXT: xxmrghd v2, v2, vs0
972 ; CHECK-BE-LABEL: testDoubleImm2:
973 ; CHECK-BE: # %bb.0: # %entry
974 ; CHECK-BE-NEXT: lfd f0, 0(r5)
975 ; CHECK-BE-NEXT: xxpermdi v2, vs0, v2, 1
978 ; CHECK-P9-LABEL: testDoubleImm2:
979 ; CHECK-P9: # %bb.0: # %entry
980 ; CHECK-P9-NEXT: lfd f0, 0(r5)
981 ; CHECK-P9-NEXT: xxpermdi v2, vs0, v2, 1
984 ; AIX-P8-LABEL: testDoubleImm2:
985 ; AIX-P8: # %bb.0: # %entry
986 ; AIX-P8-NEXT: lfd f0, 0(r3)
987 ; AIX-P8-NEXT: xxpermdi v2, vs0, v2, 1
990 %0 = load double, ptr %b, align 8
991 %vecins = insertelement <2 x double> %a, double %0, i32 0
992 ret <2 x double> %vecins
995 define <2 x double> @testDoubleImm3(<2 x double> %a, ptr %b) {
996 ; CHECK-LABEL: testDoubleImm3:
997 ; CHECK: # %bb.0: # %entry
998 ; CHECK-NEXT: lfd f0, 4(r5)
999 ; CHECK-NEXT: xxmrghd v2, v2, vs0
1002 ; CHECK-BE-LABEL: testDoubleImm3:
1003 ; CHECK-BE: # %bb.0: # %entry
1004 ; CHECK-BE-NEXT: lfd f0, 4(r5)
1005 ; CHECK-BE-NEXT: xxpermdi v2, vs0, v2, 1
1006 ; CHECK-BE-NEXT: blr
1008 ; CHECK-P9-LABEL: testDoubleImm3:
1009 ; CHECK-P9: # %bb.0: # %entry
1010 ; CHECK-P9-NEXT: lfd f0, 4(r5)
1011 ; CHECK-P9-NEXT: xxpermdi v2, vs0, v2, 1
1012 ; CHECK-P9-NEXT: blr
1014 ; AIX-P8-LABEL: testDoubleImm3:
1015 ; AIX-P8: # %bb.0: # %entry
1016 ; AIX-P8-NEXT: lfd f0, 4(r3)
1017 ; AIX-P8-NEXT: xxpermdi v2, vs0, v2, 1
1020 %add.ptr = getelementptr inbounds i32, ptr %b, i64 1
1021 %0 = load double, ptr %add.ptr, align 8
1022 %vecins = insertelement <2 x double> %a, double %0, i32 0
1023 ret <2 x double> %vecins
1026 define <2 x double> @testDoubleImm4(<2 x double> %a, ptr %b) {
1027 ; CHECK-LABEL: testDoubleImm4:
1028 ; CHECK: # %bb.0: # %entry
1029 ; CHECK-NEXT: plfd f0, 262144(r5), 0
1030 ; CHECK-NEXT: xxmrghd v2, v2, vs0
1033 ; CHECK-BE-LABEL: testDoubleImm4:
1034 ; CHECK-BE: # %bb.0: # %entry
1035 ; CHECK-BE-NEXT: plfd f0, 262144(r5), 0
1036 ; CHECK-BE-NEXT: xxpermdi v2, vs0, v2, 1
1037 ; CHECK-BE-NEXT: blr
1039 ; CHECK-P9-LABEL: testDoubleImm4:
1040 ; CHECK-P9: # %bb.0: # %entry
1041 ; CHECK-P9-NEXT: lis r3, 4
1042 ; CHECK-P9-NEXT: lfdx f0, r5, r3
1043 ; CHECK-P9-NEXT: xxpermdi v2, vs0, v2, 1
1044 ; CHECK-P9-NEXT: blr
1046 ; AIX-P8-LABEL: testDoubleImm4:
1047 ; AIX-P8: # %bb.0: # %entry
1048 ; AIX-P8-NEXT: lis r4, 4
1049 ; AIX-P8-NEXT: lfdx f0, r3, r4
1050 ; AIX-P8-NEXT: xxpermdi v2, vs0, v2, 1
1053 %add.ptr = getelementptr inbounds i32, ptr %b, i64 65536
1054 %0 = load double, ptr %add.ptr, align 8
1055 %vecins = insertelement <2 x double> %a, double %0, i32 0
1056 ret <2 x double> %vecins
1059 define <2 x double> @testDoubleImm5(<2 x double> %a, ptr %b) {
1060 ; CHECK-LABEL: testDoubleImm5:
1061 ; CHECK: # %bb.0: # %entry
1062 ; CHECK-NEXT: li r3, 1
1063 ; CHECK-NEXT: rldic r3, r3, 38, 25
1064 ; CHECK-NEXT: lfdx f0, r5, r3
1065 ; CHECK-NEXT: xxmrghd v2, v2, vs0
1068 ; CHECK-BE-LABEL: testDoubleImm5:
1069 ; CHECK-BE: # %bb.0: # %entry
1070 ; CHECK-BE-NEXT: li r3, 1
1071 ; CHECK-BE-NEXT: rldic r3, r3, 38, 25
1072 ; CHECK-BE-NEXT: lfdx f0, r5, r3
1073 ; CHECK-BE-NEXT: xxpermdi v2, vs0, v2, 1
1074 ; CHECK-BE-NEXT: blr
1076 ; CHECK-P9-LABEL: testDoubleImm5:
1077 ; CHECK-P9: # %bb.0: # %entry
1078 ; CHECK-P9-NEXT: li r3, 1
1079 ; CHECK-P9-NEXT: rldic r3, r3, 38, 25
1080 ; CHECK-P9-NEXT: lfdx f0, r5, r3
1081 ; CHECK-P9-NEXT: xxpermdi v2, vs0, v2, 1
1082 ; CHECK-P9-NEXT: blr
1084 ; AIX-P8-64-LABEL: testDoubleImm5:
1085 ; AIX-P8-64: # %bb.0: # %entry
1086 ; AIX-P8-64-NEXT: li r4, 1
1087 ; AIX-P8-64-NEXT: rldic r4, r4, 38, 25
1088 ; AIX-P8-64-NEXT: lfdx f0, r3, r4
1089 ; AIX-P8-64-NEXT: xxpermdi v2, vs0, v2, 1
1090 ; AIX-P8-64-NEXT: blr
1092 ; AIX-P8-32-LABEL: testDoubleImm5:
1093 ; AIX-P8-32: # %bb.0: # %entry
1094 ; AIX-P8-32-NEXT: lfd f0, 0(r3)
1095 ; AIX-P8-32-NEXT: xxpermdi v2, vs0, v2, 1
1096 ; AIX-P8-32-NEXT: blr
1098 %add.ptr = getelementptr inbounds i32, ptr %b, i64 68719476736
1099 %0 = load double, ptr %add.ptr, align 8
1100 %vecins = insertelement <2 x double> %a, double %0, i32 0
1101 ret <2 x double> %vecins
1104 define dso_local <4 x float> @testInsertDoubleToFloat(<4 x float> %a, double %b) local_unnamed_addr #0 {
1105 ; CHECK-LABEL: testInsertDoubleToFloat:
1106 ; CHECK: # %bb.0: # %entry
1107 ; CHECK-NEXT: xscvdpsp f0, f1
1108 ; CHECK-NEXT: xxinsertw v2, vs0, 8
1111 ; CHECK-BE-LABEL: testInsertDoubleToFloat:
1112 ; CHECK-BE: # %bb.0: # %entry
1113 ; CHECK-BE-NEXT: xscvdpsp f0, f1
1114 ; CHECK-BE-NEXT: xxinsertw v2, vs0, 4
1115 ; CHECK-BE-NEXT: blr
1117 ; CHECK-P9-LABEL: testInsertDoubleToFloat:
1118 ; CHECK-P9: # %bb.0: # %entry
1119 ; CHECK-P9-NEXT: xscvdpsp f0, f1
1120 ; CHECK-P9-NEXT: xxinsertw v2, vs0, 4
1121 ; CHECK-P9-NEXT: blr
1123 ; AIX-P8-64-LABEL: testInsertDoubleToFloat:
1124 ; AIX-P8-64: # %bb.0: # %entry
1125 ; AIX-P8-64-NEXT: xsrsp f0, f1
1126 ; AIX-P8-64-NEXT: ld r3, L..C8(r2) # %const.0
1127 ; AIX-P8-64-NEXT: lxvw4x v3, 0, r3
1128 ; AIX-P8-64-NEXT: xscvdpspn v4, f0
1129 ; AIX-P8-64-NEXT: vperm v2, v2, v4, v3
1130 ; AIX-P8-64-NEXT: blr
1132 ; AIX-P8-32-LABEL: testInsertDoubleToFloat:
1133 ; AIX-P8-32: # %bb.0: # %entry
1134 ; AIX-P8-32-NEXT: xsrsp f0, f1
1135 ; AIX-P8-32-NEXT: lwz r3, L..C12(r2) # %const.0
1136 ; AIX-P8-32-NEXT: lxvw4x v3, 0, r3
1137 ; AIX-P8-32-NEXT: xscvdpspn v4, f0
1138 ; AIX-P8-32-NEXT: vperm v2, v2, v4, v3
1139 ; AIX-P8-32-NEXT: blr
1141 %conv = fptrunc double %b to float
1142 %vecins = insertelement <4 x float> %a, float %conv, i32 1
1143 ret <4 x float> %vecins