1 ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64-ibm-aix-xcoff -vec-extabi \
2 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefix=CHECK-64
3 ; RUN: llc -mcpu=pwr9 -mtriple=powerpc-ibm-aix-xcoff -vec-extabi \
4 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefix=CHECK-32
6 define <4 x float> @_Z7testInsILj0ELj0EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
8 ; CHECK-LABEL: _Z7testInsILj0ELj0EDv4_fET1_S1_S1_
9 ; CHECK: xxsldwi 0, 35, 35, 3
10 ; CHECK: xxinsertw 34, 0, 0
11 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
12 ret <4 x float> %vecins
15 define <4 x float> @_Z7testInsILj0ELj1EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
17 ; CHECK-LABEL: _Z7testInsILj0ELj1EDv4_fET1_S1_S1_
19 ; CHECK: xxinsertw 34, 35, 0
20 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 5, i32 1, i32 2, i32 3>
21 ret <4 x float> %vecins
24 define <4 x float> @_Z7testInsILj0ELj2EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
26 ; CHECK-LABEL: _Z7testInsILj0ELj2EDv4_fET1_S1_S1_
27 ; CHECK: xxsldwi 0, 35, 35, 1
28 ; CHECK: xxinsertw 34, 0, 0
29 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 6, i32 1, i32 2, i32 3>
30 ret <4 x float> %vecins
33 define <4 x float> @_Z7testInsILj0ELj3EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
35 ; CHECK-LABEL: _Z7testInsILj0ELj3EDv4_fET1_S1_S1_
36 ; CHECK: xxswapd 0, 35
37 ; CHECK: xxinsertw 34, 0, 0
38 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 7, i32 1, i32 2, i32 3>
39 ret <4 x float> %vecins
42 define <4 x float> @_Z7testInsILj1ELj0EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
44 ; CHECK-LABEL: _Z7testInsILj1ELj0EDv4_fET1_S1_S1_
45 ; CHECK: xxsldwi 0, 35, 35, 3
46 ; CHECK: xxinsertw 34, 0, 4
47 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 3>
48 ret <4 x float> %vecins
51 define <4 x float> @_Z7testInsILj1ELj1EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
53 ; CHECK-LABEL: _Z7testInsILj1ELj1EDv4_fET1_S1_S1_
55 ; CHECK: xxinsertw 34, 35, 4
56 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 5, i32 2, i32 3>
57 ret <4 x float> %vecins
60 define <4 x float> @_Z7testInsILj1ELj2EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
62 ; CHECK-LABEL: _Z7testInsILj1ELj2EDv4_fET1_S1_S1_
63 ; CHECK: xxsldwi 0, 35, 35, 1
64 ; CHECK: xxinsertw 34, 0, 4
65 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 6, i32 2, i32 3>
66 ret <4 x float> %vecins
69 define <4 x float> @_Z7testInsILj1ELj3EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
71 ; CHECK-LABEL: _Z7testInsILj1ELj3EDv4_fET1_S1_S1_
72 ; CHECK: xxswapd 0, 35
73 ; CHECK: xxinsertw 34, 0, 4
74 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 7, i32 2, i32 3>
75 ret <4 x float> %vecins
78 define <4 x float> @_Z7testInsILj2ELj0EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
80 ; CHECK-LABEL: _Z7testInsILj2ELj0EDv4_fET1_S1_S1_
81 ; CHECK: xxsldwi 0, 35, 35, 3
82 ; CHECK: xxinsertw 34, 0, 8
83 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 3>
84 ret <4 x float> %vecins
87 define <4 x float> @_Z7testInsILj2ELj1EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
89 ; CHECK-LABEL: _Z7testInsILj2ELj1EDv4_fET1_S1_S1_
91 ; CHECK: xxinsertw 34, 35, 8
92 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 5, i32 3>
93 ret <4 x float> %vecins
96 define <4 x float> @_Z7testInsILj2ELj2EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
98 ; CHECK-LABEL: _Z7testInsILj2ELj2EDv4_fET1_S1_S1_
99 ; CHECK: xxsldwi 0, 35, 35, 1
100 ; CHECK: xxinsertw 34, 0, 8
101 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 6, i32 3>
102 ret <4 x float> %vecins
105 define <4 x float> @_Z7testInsILj2ELj3EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
107 ; CHECK-LABEL: _Z7testInsILj2ELj3EDv4_fET1_S1_S1_
108 ; CHECK: xxswapd 0, 35
109 ; CHECK: xxinsertw 34, 0, 8
110 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 7, i32 3>
111 ret <4 x float> %vecins
114 define <4 x float> @_Z7testInsILj3ELj0EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
116 ; CHECK-LABEL: _Z7testInsILj3ELj0EDv4_fET1_S1_S1_
117 ; CHECK: xxsldwi 0, 35, 35, 3
118 ; CHECK: xxinsertw 34, 0, 12
119 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
120 ret <4 x float> %vecins
123 define <4 x float> @_Z7testInsILj3ELj1EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
125 ; CHECK-LABEL: _Z7testInsILj3ELj1EDv4_fET1_S1_S1_
127 ; CHECK: xxinsertw 34, 35, 12
128 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 5>
129 ret <4 x float> %vecins
132 define <4 x float> @_Z7testInsILj3ELj2EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
134 ; CHECK-LABEL: _Z7testInsILj3ELj2EDv4_fET1_S1_S1_
135 ; CHECK: xxsldwi 0, 35, 35, 1
136 ; CHECK: xxinsertw 34, 0, 12
137 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 6>
138 ret <4 x float> %vecins
141 define <4 x float> @_Z7testInsILj3ELj3EDv4_fET1_S1_S1_(<4 x float> %a, <4 x float> %b) {
143 ; CHECK-LABEL: _Z7testInsILj3ELj3EDv4_fET1_S1_S1_
144 ; CHECK: xxswapd 0, 35
145 ; CHECK: xxinsertw 34, 0, 12
146 %vecins = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
147 ret <4 x float> %vecins
150 define <4 x i32> @_Z7testInsILj0ELj0EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
152 ; CHECK-LABEL: _Z7testInsILj0ELj0EDv4_jET1_S1_S1_
153 ; CHECK: xxsldwi 0, 35, 35, 3
154 ; CHECK: xxinsertw 34, 0, 0
155 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
156 ret <4 x i32> %vecins
159 define <4 x i32> @_Z7testInsILj0ELj1EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
161 ; CHECK-LABEL: _Z7testInsILj0ELj1EDv4_jET1_S1_S1_
163 ; CHECK: xxinsertw 34, 35, 0
164 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 1, i32 2, i32 3>
165 ret <4 x i32> %vecins
168 define <4 x i32> @_Z7testInsILj0ELj2EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
170 ; CHECK-LABEL: _Z7testInsILj0ELj2EDv4_jET1_S1_S1_
171 ; CHECK: xxsldwi 0, 35, 35, 1
172 ; CHECK: xxinsertw 34, 0, 0
173 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 1, i32 2, i32 3>
174 ret <4 x i32> %vecins
177 define <4 x i32> @_Z7testInsILj0ELj3EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
179 ; CHECK-LABEL: _Z7testInsILj0ELj3EDv4_jET1_S1_S1_
180 ; CHECK: xxswapd 0, 35
181 ; CHECK: xxinsertw 34, 0, 0
182 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 7, i32 1, i32 2, i32 3>
183 ret <4 x i32> %vecins
186 define <4 x i32> @_Z7testInsILj1ELj0EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
188 ; CHECK-LABEL: _Z7testInsILj1ELj0EDv4_jET1_S1_S1_
189 ; CHECK: xxsldwi 0, 35, 35, 3
190 ; CHECK: xxinsertw 34, 0, 4
191 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 3>
192 ret <4 x i32> %vecins
195 define <4 x i32> @_Z7testInsILj1ELj1EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
197 ; CHECK-LABEL: _Z7testInsILj1ELj1EDv4_jET1_S1_S1_
199 ; CHECK: xxinsertw 34, 35, 4
200 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 5, i32 2, i32 3>
201 ret <4 x i32> %vecins
204 define <4 x i32> @_Z7testInsILj1ELj2EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
206 ; CHECK-LABEL: _Z7testInsILj1ELj2EDv4_jET1_S1_S1_
207 ; CHECK: xxsldwi 0, 35, 35, 1
208 ; CHECK: xxinsertw 34, 0, 4
209 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 6, i32 2, i32 3>
210 ret <4 x i32> %vecins
213 define <4 x i32> @_Z7testInsILj1ELj3EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
215 ; CHECK-LABEL: _Z7testInsILj1ELj3EDv4_jET1_S1_S1_
216 ; CHECK: xxswapd 0, 35
217 ; CHECK: xxinsertw 34, 0, 4
218 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 7, i32 2, i32 3>
219 ret <4 x i32> %vecins
222 define <4 x i32> @_Z7testInsILj2ELj0EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
224 ; CHECK-LABEL: _Z7testInsILj2ELj0EDv4_jET1_S1_S1_
225 ; CHECK: xxsldwi 0, 35, 35, 3
226 ; CHECK: xxinsertw 34, 0, 8
227 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 3>
228 ret <4 x i32> %vecins
231 define <4 x i32> @_Z7testInsILj2ELj1EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
233 ; CHECK-LABEL: _Z7testInsILj2ELj1EDv4_jET1_S1_S1_
235 ; CHECK: xxinsertw 34, 35, 8
236 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 5, i32 3>
237 ret <4 x i32> %vecins
240 define <4 x i32> @_Z7testInsILj2ELj2EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
242 ; CHECK-LABEL: _Z7testInsILj2ELj2EDv4_jET1_S1_S1_
243 ; CHECK: xxsldwi 0, 35, 35, 1
244 ; CHECK: xxinsertw 34, 0, 8
245 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 6, i32 3>
246 ret <4 x i32> %vecins
249 define <4 x i32> @_Z7testInsILj2ELj3EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
251 ; CHECK-LABEL: _Z7testInsILj2ELj3EDv4_jET1_S1_S1_
252 ; CHECK: xxswapd 0, 35
253 ; CHECK: xxinsertw 34, 0, 8
254 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 7, i32 3>
255 ret <4 x i32> %vecins
258 define <4 x i32> @_Z7testInsILj3ELj0EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
260 ; CHECK-LABEL: _Z7testInsILj3ELj0EDv4_jET1_S1_S1_
261 ; CHECK: xxsldwi 0, 35, 35, 3
262 ; CHECK: xxinsertw 34, 0, 12
263 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
264 ret <4 x i32> %vecins
267 define <4 x i32> @_Z7testInsILj3ELj1EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
269 ; CHECK-LABEL: _Z7testInsILj3ELj1EDv4_jET1_S1_S1_
271 ; CHECK: xxinsertw 34, 35, 12
272 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 5>
273 ret <4 x i32> %vecins
276 define <4 x i32> @_Z7testInsILj3ELj2EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
278 ; CHECK-LABEL: _Z7testInsILj3ELj2EDv4_jET1_S1_S1_
279 ; CHECK: xxsldwi 0, 35, 35, 1
280 ; CHECK: xxinsertw 34, 0, 12
281 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 6>
282 ret <4 x i32> %vecins
285 define <4 x i32> @_Z7testInsILj3ELj3EDv4_jET1_S1_S1_(<4 x i32> %a, <4 x i32> %b) {
287 ; CHECK-LABEL: _Z7testInsILj3ELj3EDv4_jET1_S1_S1_
288 ; CHECK: xxswapd 0, 35
289 ; CHECK: xxinsertw 34, 0, 12
290 %vecins = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
291 ret <4 x i32> %vecins
294 define float @_Z13testUiToFpExtILj0EEfDv4_j(<4 x i32> %a) {
296 ; CHECK-64-LABEL: _Z13testUiToFpExtILj0EEfDv4_j
297 ; CHECK-64: xxextractuw 0, 34, 0
298 ; CHECK-64: xscvuxdsp 1, 0
299 ; CHECK-32-LABEL: _Z13testUiToFpExtILj0EEfDv4_j
300 ; CHECK-32: lfiwzx 0, 0, 3
301 ; CHECK-32: xscvuxdsp 1, 0
302 %vecext = extractelement <4 x i32> %a, i32 0
303 %conv = uitofp i32 %vecext to float
307 define float @_Z13testUiToFpExtILj1EEfDv4_j(<4 x i32> %a) {
309 ; CHECK-64-LABEL: _Z13testUiToFpExtILj1EEfDv4_j
310 ; CHECK-64: xxextractuw 0, 34, 4
311 ; CHECK-64: xscvuxdsp 1, 0
312 ; CHECK-32-LABEL: _Z13testUiToFpExtILj1EEfDv4_j
313 ; CHECK-32: lfiwzx 0, 0, 3
314 ; CHECK-32: xscvuxdsp 1, 0
315 %vecext = extractelement <4 x i32> %a, i32 1
316 %conv = uitofp i32 %vecext to float
320 define float @_Z13testUiToFpExtILj2EEfDv4_j(<4 x i32> %a) {
322 ; CHECK-64-LABEL: _Z13testUiToFpExtILj2EEfDv4_j
323 ; CHECK-64: xxextractuw 0, 34, 8
324 ; CHECK-64: xscvuxdsp 1, 0
325 ; CHECK-32-LABEL: _Z13testUiToFpExtILj2EEfDv4_j
326 ; CHECK-32: lfiwzx 0, 0, 3
327 ; CHECK-32: xscvuxdsp 1, 0
328 %vecext = extractelement <4 x i32> %a, i32 2
329 %conv = uitofp i32 %vecext to float
333 define float @_Z13testUiToFpExtILj3EEfDv4_j(<4 x i32> %a) {
335 ; CHECK-64-LABEL: _Z13testUiToFpExtILj3EEfDv4_j
336 ; CHECK-64: xxextractuw 0, 34, 12
337 ; CHECK-64: xscvuxdsp 1, 0
338 ; CHECK-32-LABEL: _Z13testUiToFpExtILj3EEfDv4_j
339 ; CHECK-32: lfiwzx 0, 0, 3
340 ; CHECK-32: xscvuxdsp 1, 0
341 %vecext = extractelement <4 x i32> %a, i32 3
342 %conv = uitofp i32 %vecext to float
346 ; Verify we generate optimal code for unsigned vector int elem extract followed
347 ; by conversion to double
349 define double @conv2dlbTestui0(<4 x i32> %a) {
351 ; CHECK-64-LABEL: conv2dlbTestui0
352 ; CHECK-64: xxextractuw [[CP64:[0-9]+]], 34, 0
353 ; CHECK-64: xscvuxddp 1, [[CP64]]
354 ; CHECK-32-LABEL: conv2dlbTestui0
355 ; CHECK-32: lfiwzx [[CP32:[0-9]+]], 0, 3
356 ; CHECK-32: xscvuxddp 1, [[CP32]]
357 %0 = extractelement <4 x i32> %a, i32 0
358 %1 = uitofp i32 %0 to double
362 define double @conv2dlbTestui1(<4 x i32> %a) {
364 ; CHECK-64-LABEL: conv2dlbTestui1
365 ; CHECK-64: xxextractuw [[CP64:[0-9]+]], 34, 4
366 ; CHECK-64: xscvuxddp 1, [[CP64]]
367 ; CHECK-32-LABEL: conv2dlbTestui1
368 ; CHECK-32: lfiwzx [[CP32:[0-9]+]], 0, 3
369 ; CHECK-32: xscvuxddp 1, [[CP32]]
370 %0 = extractelement <4 x i32> %a, i32 1
371 %1 = uitofp i32 %0 to double
375 define double @conv2dlbTestui2(<4 x i32> %a) {
377 ; CHECK-64-LABEL: conv2dlbTestui2
378 ; CHECK-64: xxextractuw [[CP64:[0-9]+]], 34, 8
379 ; CHECK-64: xscvuxddp 1, [[CP64]]
380 ; CHECK-32-LABEL: conv2dlbTestui2
381 ; CHECK-32: lfiwzx [[CP32:[0-9]+]], 0, 3
382 ; CHECK-32: xscvuxddp 1, [[CP32]]
383 %0 = extractelement <4 x i32> %a, i32 2
384 %1 = uitofp i32 %0 to double
388 define double @conv2dlbTestui3(<4 x i32> %a) {
390 ; CHECK-64-LABEL: conv2dlbTestui3
391 ; CHECK-64: xxextractuw [[CP64:[0-9]+]], 34, 12
392 ; CHECK-64: xscvuxddp 1, [[CP64]]
393 ; CHECK-32-LABEL: conv2dlbTestui3
394 ; CHECK-32: lfiwzx [[CP32:[0-9]+]], 0, 3
395 ; CHECK-32: xscvuxddp 1, [[CP32]]
396 %0 = extractelement <4 x i32> %a, i32 3
397 %1 = uitofp i32 %0 to double
401 ; verify we don't crash for variable elem extract
402 define double @conv2dlbTestuiVar(<4 x i32> %a, i32 zeroext %elem) {
404 %vecext = extractelement <4 x i32> %a, i32 %elem
405 %conv = uitofp i32 %vecext to double
409 define <4 x float> @_Z10testInsEltILj0EDv4_ffET0_S1_T1_(<4 x float> %a, float %b) {
411 ; CHECK-LABEL: _Z10testInsEltILj0EDv4_ffET0_S1_T1_
412 ; CHECK: xscvdpspn 0, 1
413 ; CHECK: xxsldwi 0, 0, 0, 3
414 ; CHECK: xxinsertw 34, 0, 0
415 %vecins = insertelement <4 x float> %a, float %b, i32 0
416 ret <4 x float> %vecins
419 define <4 x float> @_Z10testInsEltILj1EDv4_ffET0_S1_T1_(<4 x float> %a, float %b) {
421 ; CHECK-LABEL: _Z10testInsEltILj1EDv4_ffET0_S1_T1_
422 ; CHECK: xscvdpspn 0, 1
423 ; CHECK: xxsldwi 0, 0, 0, 3
424 ; CHECK: xxinsertw 34, 0, 4
425 %vecins = insertelement <4 x float> %a, float %b, i32 1
426 ret <4 x float> %vecins
429 define <4 x float> @_Z10testInsEltILj2EDv4_ffET0_S1_T1_(<4 x float> %a, float %b) {
431 ; CHECK-LABEL: _Z10testInsEltILj2EDv4_ffET0_S1_T1_
432 ; CHECK: xscvdpspn 0, 1
433 ; CHECK: xxsldwi 0, 0, 0, 3
434 ; CHECK: xxinsertw 34, 0, 8
435 %vecins = insertelement <4 x float> %a, float %b, i32 2
436 ret <4 x float> %vecins
439 define <4 x float> @_Z10testInsEltILj3EDv4_ffET0_S1_T1_(<4 x float> %a, float %b) {
441 ; CHECK-LABEL: _Z10testInsEltILj3EDv4_ffET0_S1_T1_
442 ; CHECK: xscvdpspn 0, 1
443 ; CHECK: xxsldwi 0, 0, 0, 3
444 ; CHECK: xxinsertw 34, 0, 12
445 %vecins = insertelement <4 x float> %a, float %b, i32 3
446 ret <4 x float> %vecins
449 define <4 x i32> @_Z10testInsEltILj0EDv4_jjET0_S1_T1_(<4 x i32> %a, i32 zeroext %b) {
451 ; CHECK-LABEL: _Z10testInsEltILj0EDv4_jjET0_S1_T1_
452 ; CHECK: mtfprwz 0, 3
453 ; CHECK: xxinsertw 34, 0, 0
454 %vecins = insertelement <4 x i32> %a, i32 %b, i32 0
455 ret <4 x i32> %vecins
458 define <4 x i32> @_Z10testInsEltILj1EDv4_jjET0_S1_T1_(<4 x i32> %a, i32 zeroext %b) {
460 ; CHECK-LABEL: _Z10testInsEltILj1EDv4_jjET0_S1_T1_
461 ; CHECK: mtfprwz 0, 3
462 ; CHECK: xxinsertw 34, 0, 4
463 %vecins = insertelement <4 x i32> %a, i32 %b, i32 1
464 ret <4 x i32> %vecins
467 define <4 x i32> @_Z10testInsEltILj2EDv4_jjET0_S1_T1_(<4 x i32> %a, i32 zeroext %b) {
469 ; CHECK-LABEL: _Z10testInsEltILj2EDv4_jjET0_S1_T1_
470 ; CHECK: mtfprwz 0, 3
471 ; CHECK: xxinsertw 34, 0, 8
472 %vecins = insertelement <4 x i32> %a, i32 %b, i32 2
473 ret <4 x i32> %vecins
476 define <4 x i32> @_Z10testInsEltILj3EDv4_jjET0_S1_T1_(<4 x i32> %a, i32 zeroext %b) {
478 ; CHECK-LABEL: _Z10testInsEltILj3EDv4_jjET0_S1_T1_
479 ; CHECK: mtfprwz 0, 3
480 ; CHECK: xxinsertw 34, 0, 12
481 %vecins = insertelement <4 x i32> %a, i32 %b, i32 3
482 ret <4 x i32> %vecins
485 define <4 x float> @_Z7testInsILj0ELj0EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
487 ; CHECK-LABEL: _Z7testInsILj0ELj0EDv4_fET1_S1_S1_
488 ; CHECK: xxsldwi 0, 35, 35, 3
489 ; CHECK: xxinsertw 34, 0, 0
490 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
491 ret <4 x float> %vecins
494 define <4 x float> @_Z7testInsILj0ELj1EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
496 ; CHECK-LABEL: _Z7testInsILj0ELj1EDv4_fET1_S1_S1_
498 ; CHECK: xxinsertw 34, 35, 0
499 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 1, i32 5, i32 6, i32 7>
500 ret <4 x float> %vecins
503 define <4 x float> @_Z7testInsILj0ELj2EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
505 ; CHECK-LABEL: _Z7testInsILj0ELj2EDv4_fET1_S1_S1_
506 ; CHECK: xxsldwi 0, 35, 35, 1
507 ; CHECK: xxinsertw 34, 0, 0
508 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 2, i32 5, i32 6, i32 7>
509 ret <4 x float> %vecins
512 define <4 x float> @_Z7testInsILj0ELj3EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
514 ; CHECK-LABEL: _Z7testInsILj0ELj3EDv4_fET1_S1_S1_
515 ; CHECK: xxswapd 0, 35
516 ; CHECK: xxinsertw 34, 0, 0
517 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 3, i32 5, i32 6, i32 7>
518 ret <4 x float> %vecins
521 define <4 x float> @_Z7testInsILj1ELj0EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
523 ; CHECK-LABEL: _Z7testInsILj1ELj0EDv4_fET1_S1_S1_
524 ; CHECK: xxsldwi 0, 35, 35, 3
525 ; CHECK: xxinsertw 34, 0, 4
526 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 4, i32 0, i32 6, i32 7>
527 ret <4 x float> %vecins
530 define <4 x float> @_Z7testInsILj1ELj1EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
532 ; CHECK-LABEL: _Z7testInsILj1ELj1EDv4_fET1_S1_S1_
534 ; CHECK: xxinsertw 34, 35, 4
535 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 4, i32 1, i32 6, i32 7>
536 ret <4 x float> %vecins
539 define <4 x float> @_Z7testInsILj1ELj2EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
541 ; CHECK-LABEL: _Z7testInsILj1ELj2EDv4_fET1_S1_S1_
542 ; CHECK: xxsldwi 0, 35, 35, 1
543 ; CHECK: xxinsertw 34, 0, 4
544 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 4, i32 2, i32 6, i32 7>
545 ret <4 x float> %vecins
548 define <4 x float> @_Z7testInsILj1ELj3EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
550 ; CHECK-LABEL: _Z7testInsILj1ELj3EDv4_fET1_S1_S1_
551 ; CHECK: xxswapd 0, 35
552 ; CHECK: xxinsertw 34, 0, 4
553 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 4, i32 3, i32 6, i32 7>
554 ret <4 x float> %vecins
557 define <4 x float> @_Z7testInsILj2ELj0EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
559 ; CHECK-LABEL: _Z7testInsILj2ELj0EDv4_fET1_S1_S1_
560 ; CHECK: xxsldwi 0, 35, 35, 3
561 ; CHECK: xxinsertw 34, 0, 8
562 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 4, i32 5, i32 0, i32 7>
563 ret <4 x float> %vecins
566 define <4 x float> @_Z7testInsILj2ELj1EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
568 ; CHECK-LABEL: _Z7testInsILj2ELj1EDv4_fET1_S1_S1_
570 ; CHECK: xxinsertw 34, 35, 8
571 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 4, i32 5, i32 1, i32 7>
572 ret <4 x float> %vecins
575 define <4 x float> @_Z7testInsILj2ELj2EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
577 ; CHECK-LABEL: _Z7testInsILj2ELj2EDv4_fET1_S1_S1_
578 ; CHECK: xxsldwi 0, 35, 35, 1
579 ; CHECK: xxinsertw 34, 0, 8
580 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 4, i32 5, i32 2, i32 7>
581 ret <4 x float> %vecins
584 define <4 x float> @_Z7testInsILj2ELj3EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
586 ; CHECK-LABEL: _Z7testInsILj2ELj3EDv4_fET1_S1_S1_
587 ; CHECK: xxswapd 0, 35
588 ; CHECK: xxinsertw 34, 0, 8
589 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 4, i32 5, i32 3, i32 7>
590 ret <4 x float> %vecins
593 define <4 x float> @_Z7testInsILj3ELj0EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
595 ; CHECK-LABEL: _Z7testInsILj3ELj0EDv4_fET1_S1_S1_
596 ; CHECK: xxsldwi 0, 35, 35, 3
597 ; CHECK: xxinsertw 34, 0, 12
598 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 4, i32 5, i32 6, i32 0>
599 ret <4 x float> %vecins
602 define <4 x float> @_Z7testInsILj3ELj1EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
604 ; CHECK-LABEL: _Z7testInsILj3ELj1EDv4_fET1_S1_S1_
606 ; CHECK: xxinsertw 34, 35, 12
607 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 4, i32 5, i32 6, i32 1>
608 ret <4 x float> %vecins
611 define <4 x float> @_Z7testInsILj3ELj2EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
613 ; CHECK-LABEL: _Z7testInsILj3ELj2EDv4_fET1_S1_S1_
614 ; CHECK: xxsldwi 0, 35, 35, 1
615 ; CHECK: xxinsertw 34, 0, 12
616 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 4, i32 5, i32 6, i32 2>
617 ret <4 x float> %vecins
620 define <4 x float> @_Z7testInsILj3ELj3EDv4_fET1_S1_S1_r(<4 x float> %a, <4 x float> %b) {
622 ; CHECK-LABEL: _Z7testInsILj3ELj3EDv4_fET1_S1_S1_
623 ; CHECK: xxswapd 0, 35
624 ; CHECK: xxinsertw 34, 0, 12
625 %vecins = shufflevector <4 x float> %b, <4 x float> %a, <4 x i32> <i32 4, i32 5, i32 6, i32 3>
626 ret <4 x float> %vecins
629 define <4 x i32> @_Z7testInsILj0ELj0EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
631 ; CHECK-LABEL: _Z7testInsILj0ELj0EDv4_jET1_S1_S1_
632 ; CHECK: xxsldwi 0, 35, 35, 3
633 ; CHECK: xxinsertw 34, 0, 0
634 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
635 ret <4 x i32> %vecins
638 define <4 x i32> @_Z7testInsILj0ELj1EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
640 ; CHECK-LABEL: _Z7testInsILj0ELj1EDv4_jET1_S1_S1_
642 ; CHECK: xxinsertw 34, 35, 0
643 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 1, i32 5, i32 6, i32 7>
644 ret <4 x i32> %vecins
647 define <4 x i32> @_Z7testInsILj0ELj2EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
649 ; CHECK-LABEL: _Z7testInsILj0ELj2EDv4_jET1_S1_S1_
650 ; CHECK: xxsldwi 0, 35, 35, 1
651 ; CHECK: xxinsertw 34, 0, 0
652 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 2, i32 5, i32 6, i32 7>
653 ret <4 x i32> %vecins
656 define <4 x i32> @_Z7testInsILj0ELj3EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
658 ; CHECK-LABEL: _Z7testInsILj0ELj3EDv4_jET1_S1_S1_
659 ; CHECK: xxswapd 0, 35
660 ; CHECK: xxinsertw 34, 0, 0
661 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 3, i32 5, i32 6, i32 7>
662 ret <4 x i32> %vecins
665 define <4 x i32> @_Z7testInsILj1ELj0EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
667 ; CHECK-LABEL: _Z7testInsILj1ELj0EDv4_jET1_S1_S1_
668 ; CHECK: xxsldwi 0, 35, 35, 3
669 ; CHECK: xxinsertw 34, 0, 4
670 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 4, i32 0, i32 6, i32 7>
671 ret <4 x i32> %vecins
674 define <4 x i32> @_Z7testInsILj1ELj1EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
676 ; CHECK-LABEL: _Z7testInsILj1ELj1EDv4_jET1_S1_S1_
678 ; CHECK: xxinsertw 34, 35, 4
679 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 4, i32 1, i32 6, i32 7>
680 ret <4 x i32> %vecins
683 define <4 x i32> @_Z7testInsILj1ELj2EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
685 ; CHECK-LABEL: _Z7testInsILj1ELj2EDv4_jET1_S1_S1_
686 ; CHECK: xxsldwi 0, 35, 35, 1
687 ; CHECK: xxinsertw 34, 0, 4
688 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 4, i32 2, i32 6, i32 7>
689 ret <4 x i32> %vecins
692 define <4 x i32> @_Z7testInsILj1ELj3EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
694 ; CHECK-LABEL: _Z7testInsILj1ELj3EDv4_jET1_S1_S1_
695 ; CHECK: xxswapd 0, 35
696 ; CHECK: xxinsertw 34, 0, 4
697 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 4, i32 3, i32 6, i32 7>
698 ret <4 x i32> %vecins
701 define <4 x i32> @_Z7testInsILj2ELj0EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
703 ; CHECK-LABEL: _Z7testInsILj2ELj0EDv4_jET1_S1_S1_
704 ; CHECK: xxsldwi 0, 35, 35, 3
705 ; CHECK: xxinsertw 34, 0, 8
706 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 4, i32 5, i32 0, i32 7>
707 ret <4 x i32> %vecins
710 define <4 x i32> @_Z7testInsILj2ELj1EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
712 ; CHECK-LABEL: _Z7testInsILj2ELj1EDv4_jET1_S1_S1_
714 ; CHECK: xxinsertw 34, 35, 8
715 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 4, i32 5, i32 1, i32 7>
716 ret <4 x i32> %vecins
719 define <4 x i32> @_Z7testInsILj2ELj2EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
721 ; CHECK-LABEL: _Z7testInsILj2ELj2EDv4_jET1_S1_S1_
722 ; CHECK: xxsldwi 0, 35, 35, 1
723 ; CHECK: xxinsertw 34, 0, 8
724 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 4, i32 5, i32 2, i32 7>
725 ret <4 x i32> %vecins
728 define <4 x i32> @_Z7testInsILj2ELj3EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
730 ; CHECK-LABEL: _Z7testInsILj2ELj3EDv4_jET1_S1_S1_
731 ; CHECK: xxswapd 0, 35
732 ; CHECK: xxinsertw 34, 0, 8
733 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 4, i32 5, i32 3, i32 7>
734 ret <4 x i32> %vecins
737 define <4 x i32> @_Z7testInsILj3ELj0EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
739 ; CHECK-LABEL: _Z7testInsILj3ELj0EDv4_jET1_S1_S1_
740 ; CHECK: xxsldwi 0, 35, 35, 3
741 ; CHECK: xxinsertw 34, 0, 12
742 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 4, i32 5, i32 6, i32 0>
743 ret <4 x i32> %vecins
746 define <4 x i32> @_Z7testInsILj3ELj1EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
748 ; CHECK-LABEL: _Z7testInsILj3ELj1EDv4_jET1_S1_S1_
750 ; CHECK: xxinsertw 34, 35, 12
751 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 4, i32 5, i32 6, i32 1>
752 ret <4 x i32> %vecins
755 define <4 x i32> @_Z7testInsILj3ELj2EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
757 ; CHECK-LABEL: _Z7testInsILj3ELj2EDv4_jET1_S1_S1_
758 ; CHECK: xxsldwi 0, 35, 35, 1
759 ; CHECK: xxinsertw 34, 0, 12
760 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 4, i32 5, i32 6, i32 2>
761 ret <4 x i32> %vecins
764 define <4 x i32> @_Z7testInsILj3ELj3EDv4_jET1_S1_S1_r(<4 x i32> %a, <4 x i32> %b) {
766 ; CHECK-LABEL: _Z7testInsILj3ELj3EDv4_jET1_S1_S1_
767 ; CHECK: xxswapd 0, 35
768 ; CHECK: xxinsertw 34, 0, 12
769 %vecins = shufflevector <4 x i32> %b, <4 x i32> %a, <4 x i32> <i32 4, i32 5, i32 6, i32 3>
770 ret <4 x i32> %vecins
772 define <4 x float> @testSameVecEl0BE(<4 x float> %a) {
774 ; CHECK-LABEL: testSameVecEl0BE
775 ; CHECK: xxinsertw 34, 34, 0
776 %vecins = shufflevector <4 x float> %a, <4 x float> %a, <4 x i32> <i32 5, i32 1, i32 2, i32 3>
777 ret <4 x float> %vecins
779 define <4 x float> @testSameVecEl2BE(<4 x float> %a) {
781 ; CHECK-LABEL: testSameVecEl2BE
782 ; CHECK: xxinsertw 34, 34, 8
783 %vecins = shufflevector <4 x float> %a, <4 x float> %a, <4 x i32> <i32 0, i32 1, i32 5, i32 3>
784 ret <4 x float> %vecins
786 define <4 x float> @testSameVecEl3BE(<4 x float> %a) {
788 ; CHECK-LABEL: testSameVecEl3BE
789 ; CHECK: xxinsertw 34, 34, 12
790 %vecins = shufflevector <4 x float> %a, <4 x float> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 5>
791 ret <4 x float> %vecins
793 define <4 x float> @insertVarF(<4 x float> %a, float %f, i32 %el) {
795 ; CHECK-LABEL: insertVarF
798 %vecins = insertelement <4 x float> %a, float %f, i32 %el
799 ret <4 x float> %vecins
801 define <4 x i32> @insertVarI(<4 x i32> %a, i32 %i, i32 %el) {
803 ; CHECK-LABEL: insertVarI
806 %vecins = insertelement <4 x i32> %a, i32 %i, i32 %el
807 ret <4 x i32> %vecins