1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=amdgcn-mesa-mesa3d -run-pass=legalizer %s -o - | FileCheck %s
3
4---
5name: test_insert_s64_s32_offset0
6body: |
7  bb.0:
8    liveins: $vgpr0_vgpr1, $vgpr2
9
10    ; CHECK-LABEL: name: test_insert_s64_s32_offset0
11    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
12    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
13    ; CHECK: [[INSERT:%[0-9]+]]:_(s64) = G_INSERT [[COPY]], [[COPY1]](s32), 0
14    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](s64)
15    %0:_(s64) = COPY $vgpr0_vgpr1
16    %1:_(s32) = COPY $vgpr2
17    %2:_(s64) = G_INSERT %0, %1, 0
18    $vgpr0_vgpr1 = COPY %2
19...
20---
21name: test_insert_s64_s32_offset32
22body: |
23  bb.0:
24    liveins: $vgpr0_vgpr1, $vgpr2
25
26    ; CHECK-LABEL: name: test_insert_s64_s32_offset32
27    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
28    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
29    ; CHECK: [[INSERT:%[0-9]+]]:_(s64) = G_INSERT [[COPY]], [[COPY1]](s32), 32
30    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](s64)
31    %0:_(s64) = COPY $vgpr0_vgpr1
32    %1:_(s32) = COPY $vgpr2
33    %2:_(s64) = G_INSERT %0, %1, 32
34    $vgpr0_vgpr1 = COPY %2
35...
36
37---
38name: test_insert_s64_s32_offset16
39body: |
40  bb.0:
41    liveins: $vgpr0_vgpr1, $vgpr2
42
43    ; CHECK-LABEL: name: test_insert_s64_s32_offset16
44    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
45    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
46    ; CHECK: [[INSERT:%[0-9]+]]:_(s64) = G_INSERT [[COPY]], [[COPY1]](s32), 16
47    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](s64)
48    %0:_(s64) = COPY $vgpr0_vgpr1
49    %1:_(s32) = COPY $vgpr2
50    %2:_(s64) = G_INSERT %0, %1, 16
51    $vgpr0_vgpr1 = COPY %2
52...
53
54---
55name: test_insert_s96_s32_offset0
56body: |
57  bb.0:
58    liveins: $vgpr0_vgpr1_vgpr2, $vgpr3
59
60    ; CHECK-LABEL: name: test_insert_s96_s32_offset0
61    ; CHECK: [[COPY:%[0-9]+]]:_(s96) = COPY $vgpr0_vgpr1_vgpr2
62    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr3
63    ; CHECK: [[INSERT:%[0-9]+]]:_(s96) = G_INSERT [[COPY]], [[COPY1]](s32), 0
64    ; CHECK: $vgpr0_vgpr1_vgpr2 = COPY [[INSERT]](s96)
65    %0:_(s96) = COPY $vgpr0_vgpr1_vgpr2
66    %1:_(s32) = COPY $vgpr3
67    %2:_(s96) = G_INSERT %0, %1, 0
68    $vgpr0_vgpr1_vgpr2 = COPY %2
69...
70---
71name: test_insert_s96_s32_offset32
72body: |
73  bb.0:
74    liveins: $vgpr0_vgpr1_vgpr2, $vgpr3
75
76    ; CHECK-LABEL: name: test_insert_s96_s32_offset32
77    ; CHECK: [[COPY:%[0-9]+]]:_(s96) = COPY $vgpr0_vgpr1_vgpr2
78    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr3
79    ; CHECK: [[INSERT:%[0-9]+]]:_(s96) = G_INSERT [[COPY]], [[COPY1]](s32), 32
80    ; CHECK: $vgpr0_vgpr1_vgpr2 = COPY [[INSERT]](s96)
81    %0:_(s96) = COPY $vgpr0_vgpr1_vgpr2
82    %1:_(s32) = COPY $vgpr3
83    %2:_(s96) = G_INSERT %0, %1, 32
84    $vgpr0_vgpr1_vgpr2 = COPY %2
85...
86---
87name: test_insert_s96_s32_offset64
88body: |
89  bb.0:
90    liveins: $vgpr0_vgpr1_vgpr2, $vgpr3
91
92    ; CHECK-LABEL: name: test_insert_s96_s32_offset64
93    ; CHECK: [[COPY:%[0-9]+]]:_(s96) = COPY $vgpr0_vgpr1_vgpr2
94    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr3
95    ; CHECK: [[INSERT:%[0-9]+]]:_(s96) = G_INSERT [[COPY]], [[COPY1]](s32), 64
96    ; CHECK: $vgpr0_vgpr1_vgpr2 = COPY [[INSERT]](s96)
97    %0:_(s96) = COPY $vgpr0_vgpr1_vgpr2
98    %1:_(s32) = COPY $vgpr3
99    %2:_(s96) = G_INSERT %0, %1, 64
100    $vgpr0_vgpr1_vgpr2 = COPY %2
101...
102---
103name: test_insert_s128_s32_offset0
104body: |
105  bb.0:
106    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4
107
108    ; CHECK-LABEL: name: test_insert_s128_s32_offset0
109    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
110    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr4
111    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[COPY1]](s32), 0
112    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
113    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
114    %1:_(s32) = COPY $vgpr4
115    %2:_(s128) = G_INSERT %0, %1, 0
116    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
117...
118---
119name: test_insert_s128_s32_offset32
120body: |
121  bb.0:
122    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4
123
124    ; CHECK-LABEL: name: test_insert_s128_s32_offset32
125    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
126    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr4
127    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[COPY1]](s32), 32
128    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
129    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
130    %1:_(s32) = COPY $vgpr4
131    %2:_(s128) = G_INSERT %0, %1, 32
132    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
133...
134---
135name: test_insert_s128_s32_offset64
136body: |
137  bb.0:
138    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4
139
140    ; CHECK-LABEL: name: test_insert_s128_s32_offset64
141    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
142    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr4
143    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[COPY1]](s32), 64
144    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
145    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
146    %1:_(s32) = COPY $vgpr4
147    %2:_(s128) = G_INSERT %0, %1, 64
148    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
149...
150---
151name: test_insert_s128_s32_offset96
152body: |
153  bb.0:
154    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4
155
156    ; CHECK-LABEL: name: test_insert_s128_s32_offset96
157    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
158    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr4
159    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[COPY1]](s32), 96
160    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
161    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
162    %1:_(s32) = COPY $vgpr4
163    %2:_(s128) = G_INSERT %0, %1, 96
164    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
165...
166---
167name: test_insert_s128_s64_offset0
168body: |
169  bb.0:
170    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
171
172    ; CHECK-LABEL: name: test_insert_s128_s64_offset0
173    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
174    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr4_vgpr5
175    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[COPY1]](s64), 0
176    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
177    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
178    %1:_(s64) = COPY $vgpr4_vgpr5
179    %2:_(s128) = G_INSERT %0, %1, 0
180    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
181...
182---
183name: test_insert_s128_s64_offset32
184body: |
185  bb.0:
186    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
187
188    ; CHECK-LABEL: name: test_insert_s128_s64_offset32
189    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
190    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr4_vgpr5
191    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[COPY1]](s64), 32
192    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
193    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
194    %1:_(s64) = COPY $vgpr4_vgpr5
195    %2:_(s128) = G_INSERT %0, %1, 32
196    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
197...
198---
199name: test_insert_s128_s64_offset64
200body: |
201  bb.0:
202    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
203
204    ; CHECK-LABEL: name: test_insert_s128_s64_offset64
205    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
206    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr4_vgpr5
207    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[COPY1]](s64), 64
208    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
209    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
210    %1:_(s64) = COPY $vgpr4_vgpr5
211    %2:_(s128) = G_INSERT %0, %1, 64
212    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
213...
214---
215name: test_insert_s128_s96_offset0
216body: |
217  bb.0:
218    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6
219
220    ; CHECK-LABEL: name: test_insert_s128_s96_offset0
221    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
222    ; CHECK: [[COPY1:%[0-9]+]]:_(s96) = COPY $vgpr4_vgpr5_vgpr6
223    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[COPY1]](s96), 0
224    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
225    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
226    %1:_(s96) = COPY $vgpr4_vgpr5_vgpr6
227    %2:_(s128) = G_INSERT %0, %1, 0
228    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
229...
230---
231name: test_insert_s128_s96_offset32
232body: |
233  bb.0:
234    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6
235
236    ; CHECK-LABEL: name: test_insert_s128_s96_offset32
237    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
238    ; CHECK: [[COPY1:%[0-9]+]]:_(s96) = COPY $vgpr4_vgpr5_vgpr6
239    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[COPY1]](s96), 32
240    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
241    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
242    %1:_(s96) = COPY $vgpr4_vgpr5_vgpr6
243    %2:_(s128) = G_INSERT %0, %1, 32
244    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
245...
246---
247name: test_insert_p0_s32_offset0
248body: |
249  bb.0:
250    liveins: $vgpr0_vgpr1, $vgpr2
251
252    ; CHECK-LABEL: name: test_insert_p0_s32_offset0
253    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
254    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
255    ; CHECK: [[INSERT:%[0-9]+]]:_(p0) = G_INSERT [[COPY]], [[COPY1]](s32), 0
256    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](p0)
257    %0:_(p0) = COPY $vgpr0_vgpr1
258    %1:_(s32) = COPY $vgpr2
259    %2:_(p0) = G_INSERT %0, %1, 0
260    $vgpr0_vgpr1 = COPY %2
261...
262---
263name: test_insert_p0_s32_offset32
264body: |
265  bb.0:
266    liveins: $vgpr0_vgpr1, $vgpr2
267
268    ; CHECK-LABEL: name: test_insert_p0_s32_offset32
269    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
270    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
271    ; CHECK: [[INSERT:%[0-9]+]]:_(p0) = G_INSERT [[COPY]], [[COPY1]](s32), 32
272    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](p0)
273    %0:_(p0) = COPY $vgpr0_vgpr1
274    %1:_(s32) = COPY $vgpr2
275    %2:_(p0) = G_INSERT %0, %1, 32
276    $vgpr0_vgpr1 = COPY %2
277...
278---
279name: test_insert_s128_p0_offset0
280body: |
281  bb.0:
282    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
283
284    ; CHECK-LABEL: name: test_insert_s128_p0_offset0
285    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
286    ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $vgpr4_vgpr5
287    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[COPY1]](p0), 0
288    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
289    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
290    %1:_(p0) = COPY $vgpr4_vgpr5
291    %2:_(s128) = G_INSERT %0, %1, 0
292    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
293...
294---
295name: test_insert_s128_p0_offset32
296body: |
297  bb.0:
298    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
299
300    ; CHECK-LABEL: name: test_insert_s128_p0_offset32
301    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
302    ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $vgpr4_vgpr5
303    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[COPY1]](p0), 32
304    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
305    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
306    %1:_(p0) = COPY $vgpr4_vgpr5
307    %2:_(s128) = G_INSERT %0, %1, 32
308    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
309...
310---
311name: test_insert_s128_p0_offset64
312body: |
313  bb.0:
314    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
315
316    ; CHECK-LABEL: name: test_insert_s128_p0_offset64
317    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
318    ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $vgpr4_vgpr5
319    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[COPY1]](p0), 64
320    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
321    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
322    %1:_(p0) = COPY $vgpr4_vgpr5
323    %2:_(s128) = G_INSERT %0, %1, 64
324    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
325...
326
327---
328name: test_insert_s128_s16_offset0
329body: |
330  bb.0:
331    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4
332
333    ; CHECK-LABEL: name: test_insert_s128_s16_offset0
334    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
335    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr4
336    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
337    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[TRUNC]](s16), 0
338    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
339    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
340    %1:_(s32) = COPY $vgpr4
341    %2:_(s16) = G_TRUNC %1
342    %3:_(s128) = G_INSERT %0, %2, 0
343    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %3
344...
345
346---
347name: test_insert_s128_s16_offset16
348body: |
349  bb.0:
350    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4
351
352    ; CHECK-LABEL: name: test_insert_s128_s16_offset16
353    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
354    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr4
355    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
356    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[TRUNC]](s16), 16
357    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
358    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
359    %1:_(s32) = COPY $vgpr4
360    %2:_(s16) = G_TRUNC %1
361    %3:_(s128) = G_INSERT %0, %2, 16
362    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %3
363...
364
365---
366name: test_insert_s128_s16_offset32
367body: |
368  bb.0:
369    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4
370
371    ; CHECK-LABEL: name: test_insert_s128_s16_offset32
372    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
373    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr4
374    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
375    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[TRUNC]](s16), 32
376    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
377    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
378    %1:_(s32) = COPY $vgpr4
379    %2:_(s16) = G_TRUNC %1
380    %3:_(s128) = G_INSERT %0, %2, 32
381    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %3
382...
383
384---
385name: test_insert_s128_s16_offset112
386body: |
387  bb.0:
388    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4
389
390    ; CHECK-LABEL: name: test_insert_s128_s16_offset112
391    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
392    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr4
393    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
394    ; CHECK: [[INSERT:%[0-9]+]]:_(s128) = G_INSERT [[COPY]], [[TRUNC]](s16), 112
395    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](s128)
396    %0:_(s128) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
397    %1:_(s32) = COPY $vgpr4
398    %2:_(s16) = G_TRUNC %1
399    %3:_(s128) = G_INSERT %0, %2, 112
400    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %3
401...
402
403---
404name: test_insert_v2s32_s32_offset0
405body: |
406  bb.0:
407    liveins: $vgpr0_vgpr1, $vgpr2
408
409    ; CHECK-LABEL: name: test_insert_v2s32_s32_offset0
410    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
411    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
412    ; CHECK: [[INSERT:%[0-9]+]]:_(<2 x s32>) = G_INSERT [[COPY]], [[COPY1]](s32), 0
413    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<2 x s32>)
414    %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
415    %1:_(s32) = COPY $vgpr2
416    %2:_(<2 x s32>) = G_INSERT %0, %1, 0
417    $vgpr0_vgpr1 = COPY %2
418...
419---
420name: test_insert_v2s32_s32_offset32
421body: |
422  bb.0:
423    liveins: $vgpr0_vgpr1, $vgpr2
424
425    ; CHECK-LABEL: name: test_insert_v2s32_s32_offset32
426    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
427    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
428    ; CHECK: [[INSERT:%[0-9]+]]:_(<2 x s32>) = G_INSERT [[COPY]], [[COPY1]](s32), 32
429    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<2 x s32>)
430    %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
431    %1:_(s32) = COPY $vgpr2
432    %2:_(<2 x s32>) = G_INSERT %0, %1, 32
433    $vgpr0_vgpr1 = COPY %2
434...
435---
436name: test_insert_v3s32_s32_offset0
437body: |
438  bb.0:
439    liveins: $vgpr0_vgpr1_vgpr2, $vgpr3
440
441    ; CHECK-LABEL: name: test_insert_v3s32_s32_offset0
442    ; CHECK: [[COPY:%[0-9]+]]:_(<3 x s32>) = COPY $vgpr0_vgpr1_vgpr2
443    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr3
444    ; CHECK: [[INSERT:%[0-9]+]]:_(<3 x s32>) = G_INSERT [[COPY]], [[COPY1]](s32), 0
445    ; CHECK: $vgpr0_vgpr1_vgpr2 = COPY [[INSERT]](<3 x s32>)
446    %0:_(<3 x s32>) = COPY $vgpr0_vgpr1_vgpr2
447    %1:_(s32) = COPY $vgpr3
448    %2:_(<3 x s32>) = G_INSERT %0, %1, 0
449    $vgpr0_vgpr1_vgpr2 = COPY %2
450...
451---
452name: test_insert_v3s32_s32_offset32
453body: |
454  bb.0:
455    liveins: $vgpr0_vgpr1_vgpr2, $vgpr3
456
457    ; CHECK-LABEL: name: test_insert_v3s32_s32_offset32
458    ; CHECK: [[COPY:%[0-9]+]]:_(<3 x s32>) = COPY $vgpr0_vgpr1_vgpr2
459    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr3
460    ; CHECK: [[INSERT:%[0-9]+]]:_(<3 x s32>) = G_INSERT [[COPY]], [[COPY1]](s32), 32
461    ; CHECK: $vgpr0_vgpr1_vgpr2 = COPY [[INSERT]](<3 x s32>)
462    %0:_(<3 x s32>) = COPY $vgpr0_vgpr1_vgpr2
463    %1:_(s32) = COPY $vgpr3
464    %2:_(<3 x s32>) = G_INSERT %0, %1, 32
465    $vgpr0_vgpr1_vgpr2 = COPY %2
466...
467---
468name: test_insert_v3s32_s32_offset64
469body: |
470  bb.0:
471    liveins: $vgpr0_vgpr1_vgpr2, $vgpr3
472
473    ; CHECK-LABEL: name: test_insert_v3s32_s32_offset64
474    ; CHECK: [[COPY:%[0-9]+]]:_(<3 x s32>) = COPY $vgpr0_vgpr1_vgpr2
475    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr3
476    ; CHECK: [[INSERT:%[0-9]+]]:_(<3 x s32>) = G_INSERT [[COPY]], [[COPY1]](s32), 64
477    ; CHECK: $vgpr0_vgpr1_vgpr2 = COPY [[INSERT]](<3 x s32>)
478    %0:_(<3 x s32>) = COPY $vgpr0_vgpr1_vgpr2
479    %1:_(s32) = COPY $vgpr3
480    %2:_(<3 x s32>) = G_INSERT %0, %1, 64
481    $vgpr0_vgpr1_vgpr2 = COPY %2
482...
483---
484name: test_insert_v4s32_s32_offset0
485body: |
486  bb.0:
487    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4
488
489    ; CHECK-LABEL: name: test_insert_v4s32_s32_offset0
490    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
491    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr4
492    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](s32), 0
493    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
494    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
495    %1:_(s32) = COPY $vgpr4
496    %2:_(<4 x s32>) = G_INSERT %0, %1, 0
497    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
498...
499---
500name: test_insert_v4s32_s32_offset32
501body: |
502  bb.0:
503    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4
504
505    ; CHECK-LABEL: name: test_insert_v4s32_s32_offset32
506    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
507    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr4
508    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](s32), 32
509    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
510    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
511    %1:_(s32) = COPY $vgpr4
512    %2:_(<4 x s32>) = G_INSERT %0, %1, 32
513    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
514...
515---
516name: test_insert_v4s32_s32_offset64
517body: |
518  bb.0:
519    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4
520
521    ; CHECK-LABEL: name: test_insert_v4s32_s32_offset64
522    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
523    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr4
524    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](s32), 64
525    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
526    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
527    %1:_(s32) = COPY $vgpr4
528    %2:_(<4 x s32>) = G_INSERT %0, %1, 64
529    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
530...
531---
532name: test_insert_v4s32_s32_offset96
533body: |
534  bb.0:
535    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4
536
537    ; CHECK-LABEL: name: test_insert_v4s32_s32_offset96
538    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
539    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr4
540    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](s32), 96
541    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
542    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
543    %1:_(s32) = COPY $vgpr4
544    %2:_(<4 x s32>) = G_INSERT %0, %1, 96
545    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
546...
547---
548name: test_insert_v4s32_s64_offset0
549body: |
550  bb.0:
551    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
552
553    ; CHECK-LABEL: name: test_insert_v4s32_s64_offset0
554    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
555    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr4_vgpr5
556    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](s64), 0
557    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
558    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
559    %1:_(s64) = COPY $vgpr4_vgpr5
560    %2:_(<4 x s32>) = G_INSERT %0, %1, 0
561    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
562...
563---
564name: test_insert_v4s32_s64_offset32
565body: |
566  bb.0:
567    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
568
569    ; CHECK-LABEL: name: test_insert_v4s32_s64_offset32
570    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
571    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr4_vgpr5
572    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](s64), 32
573    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
574    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
575    %1:_(s64) = COPY $vgpr4_vgpr5
576    %2:_(<4 x s32>) = G_INSERT %0, %1, 32
577    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
578...
579---
580name: test_insert_v4s32_s64_offset64
581body: |
582  bb.0:
583    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
584
585    ; CHECK-LABEL: name: test_insert_v4s32_s64_offset64
586    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
587    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr4_vgpr5
588    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](s64), 64
589    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
590    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
591    %1:_(s64) = COPY $vgpr4_vgpr5
592    %2:_(<4 x s32>) = G_INSERT %0, %1, 64
593    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
594...
595---
596name: test_insert_v4s32_s96_offset0
597body: |
598  bb.0:
599    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6
600
601    ; CHECK-LABEL: name: test_insert_v4s32_s96_offset0
602    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
603    ; CHECK: [[COPY1:%[0-9]+]]:_(s96) = COPY $vgpr4_vgpr5_vgpr6
604    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](s96), 0
605    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
606    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
607    %1:_(s96) = COPY $vgpr4_vgpr5_vgpr6
608    %2:_(<4 x s32>) = G_INSERT %0, %1, 0
609    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
610...
611---
612name: test_insert_v4s32_s96_offset32
613body: |
614  bb.0:
615    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6
616
617    ; CHECK-LABEL: name: test_insert_v4s32_s96_offset32
618    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
619    ; CHECK: [[COPY1:%[0-9]+]]:_(s96) = COPY $vgpr4_vgpr5_vgpr6
620    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](s96), 32
621    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
622    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
623    %1:_(s96) = COPY $vgpr4_vgpr5_vgpr6
624    %2:_(<4 x s32>) = G_INSERT %0, %1, 32
625    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
626...
627---
628name: test_insert_v4s32_v2s32_offset0
629body: |
630  bb.0:
631    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
632
633    ; CHECK-LABEL: name: test_insert_v4s32_v2s32_offset0
634    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
635    ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr4_vgpr5
636    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](<2 x s32>), 0
637    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
638    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
639    %1:_(<2 x s32>) = COPY $vgpr4_vgpr5
640    %2:_(<4 x s32>) = G_INSERT %0, %1, 0
641    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
642...
643---
644name: test_insert_v4s32_v2s32_offset32
645body: |
646  bb.0:
647    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
648
649    ; CHECK-LABEL: name: test_insert_v4s32_v2s32_offset32
650    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
651    ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr4_vgpr5
652    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](<2 x s32>), 32
653    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
654    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
655    %1:_(<2 x s32>) = COPY $vgpr4_vgpr5
656    %2:_(<4 x s32>) = G_INSERT %0, %1, 32
657    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
658...
659---
660name: test_insert_v4s32_v2s32_offset64
661body: |
662  bb.0:
663    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
664
665    ; CHECK-LABEL: name: test_insert_v4s32_v2s32_offset64
666    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
667    ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr4_vgpr5
668    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](<2 x s32>), 64
669    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
670    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
671    %1:_(<2 x s32>) = COPY $vgpr4_vgpr5
672    %2:_(<4 x s32>) = G_INSERT %0, %1, 64
673    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
674...
675---
676name: test_insert_v4s32_v3s32_offset0
677body: |
678  bb.0:
679    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6
680
681    ; CHECK-LABEL: name: test_insert_v4s32_v3s32_offset0
682    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
683    ; CHECK: [[COPY1:%[0-9]+]]:_(<3 x s32>) = COPY $vgpr4_vgpr5_vgpr6
684    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](<3 x s32>), 0
685    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
686    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
687    %1:_(<3 x s32>) = COPY $vgpr4_vgpr5_vgpr6
688    %2:_(<4 x s32>) = G_INSERT %0, %1, 0
689    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
690...
691---
692name: test_insert_v4s32_v3s32_offset32
693body: |
694  bb.0:
695    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5_vgpr6
696
697    ; CHECK-LABEL: name: test_insert_v4s32_v3s32_offset32
698    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
699    ; CHECK: [[COPY1:%[0-9]+]]:_(<3 x s32>) = COPY $vgpr4_vgpr5_vgpr6
700    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](<3 x s32>), 32
701    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
702    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
703    %1:_(<3 x s32>) = COPY $vgpr4_vgpr5_vgpr6
704    %2:_(<4 x s32>) = G_INSERT %0, %1, 32
705    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
706...
707---
708name: test_insert_v4s32_p0_offset0
709body: |
710  bb.0:
711    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
712
713    ; CHECK-LABEL: name: test_insert_v4s32_p0_offset0
714    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
715    ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $vgpr4_vgpr5
716    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](p0), 0
717    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
718    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
719    %1:_(p0) = COPY $vgpr4_vgpr5
720    %2:_(<4 x s32>) = G_INSERT %0, %1, 0
721    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
722...
723---
724name: test_insert_v4s32_p0_offset32
725body: |
726  bb.0:
727    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
728
729    ; CHECK-LABEL: name: test_insert_v4s32_p0_offset32
730    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
731    ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $vgpr4_vgpr5
732    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](p0), 32
733    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
734    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
735    %1:_(p0) = COPY $vgpr4_vgpr5
736    %2:_(<4 x s32>) = G_INSERT %0, %1, 32
737    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
738...
739---
740name: test_insert_v4s32_p0_offset64
741body: |
742  bb.0:
743    liveins: $vgpr0_vgpr1_vgpr2_vgpr3, $vgpr4_vgpr5
744
745    ; CHECK-LABEL: name: test_insert_v4s32_p0_offset64
746    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
747    ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $vgpr4_vgpr5
748    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s32>) = G_INSERT [[COPY]], [[COPY1]](p0), 64
749    ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[INSERT]](<4 x s32>)
750    %0:_(<4 x s32>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
751    %1:_(p0) = COPY $vgpr4_vgpr5
752    %2:_(<4 x s32>) = G_INSERT %0, %1, 64
753    $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
754...
755
756---
757name: test_insert_v2s16_s16_offset0
758body: |
759  bb.0:
760    liveins: $vgpr0, $vgpr1
761
762    ; CHECK-LABEL: name: test_insert_v2s16_s16_offset0
763    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0
764    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
765    ; CHECK: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>)
766    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
767    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
768    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
769    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -65536
770    ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[BITCAST]], [[C1]]
771    ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND1]], [[AND]]
772    ; CHECK: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
773    ; CHECK: $vgpr0 = COPY [[BITCAST1]](<2 x s16>)
774    %0:_(<2 x s16>) = COPY $vgpr0
775    %1:_(s32) = COPY $vgpr1
776    %2:_(s16) = G_TRUNC %1
777    %3:_(<2 x s16>) = G_INSERT %0, %2, 0
778    $vgpr0 = COPY %3
779...
780
781---
782name: test_insert_v2s16_s16_offset1
783body: |
784  bb.0:
785    liveins: $vgpr0, $vgpr1
786
787    ; CHECK-LABEL: name: test_insert_v2s16_s16_offset1
788    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0
789    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
790    ; CHECK: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>)
791    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
792    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
793    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
794    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
795    ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND]], [[C1]](s32)
796    ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -131071
797    ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[BITCAST]], [[C2]]
798    ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND1]], [[SHL]]
799    ; CHECK: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
800    ; CHECK: $vgpr0 = COPY [[BITCAST1]](<2 x s16>)
801    %0:_(<2 x s16>) = COPY $vgpr0
802    %1:_(s32) = COPY $vgpr1
803    %2:_(s16) = G_TRUNC %1
804    %3:_(<2 x s16>) = G_INSERT %0, %2, 1
805    $vgpr0 = COPY %3
806...
807---
808name: test_insert_v2s16_s16_offset16
809body: |
810  bb.0:
811    liveins: $vgpr0, $vgpr1
812
813    ; CHECK-LABEL: name: test_insert_v2s16_s16_offset16
814    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0
815    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
816    ; CHECK: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>)
817    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
818    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
819    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
820    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
821    ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND]], [[C1]](s32)
822    ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[BITCAST]], [[C]]
823    ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND1]], [[SHL]]
824    ; CHECK: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
825    ; CHECK: $vgpr0 = COPY [[BITCAST1]](<2 x s16>)
826    %0:_(<2 x s16>) = COPY $vgpr0
827    %1:_(s32) = COPY $vgpr1
828    %2:_(s16) = G_TRUNC %1
829    %3:_(<2 x s16>) = G_INSERT %0, %2, 16
830    $vgpr0 = COPY %3
831...
832---
833name: test_insert_v3s16_s16_offset0
834body: |
835  bb.0:
836    liveins: $vgpr0_vgpr1, $vgpr2
837
838    ; CHECK-LABEL: name: test_insert_v3s16_s16_offset0
839    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
840    ; CHECK: [[EXTRACT:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[COPY]](<4 x s16>), 0
841    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
842    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
843    ; CHECK: [[DEF:%[0-9]+]]:_(<4 x s16>) = G_IMPLICIT_DEF
844    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT]](<3 x s16>), 0
845    ; CHECK: [[INSERT1:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[INSERT]], [[TRUNC]](s16), 0
846    ; CHECK: [[EXTRACT1:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[INSERT1]](<4 x s16>), 0
847    ; CHECK: [[INSERT2:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT1]](<3 x s16>), 0
848    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT2]](<4 x s16>)
849    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
850    %1:_(<3 x s16>) = G_EXTRACT %0, 0
851    %2:_(s32) = COPY $vgpr2
852    %3:_(s16) = G_TRUNC %2
853    %4:_(<3 x s16>) = G_INSERT %1, %3, 0
854    %5:_(<4 x s16>) = G_IMPLICIT_DEF
855    %6:_(<4 x s16>) = G_INSERT %5, %4, 0
856    $vgpr0_vgpr1 = COPY %6
857...
858---
859name: test_insert_v3s16_s16_offset16
860body: |
861  bb.0:
862    liveins: $vgpr0_vgpr1, $vgpr2
863
864    ; CHECK-LABEL: name: test_insert_v3s16_s16_offset16
865    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
866    ; CHECK: [[EXTRACT:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[COPY]](<4 x s16>), 0
867    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
868    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
869    ; CHECK: [[DEF:%[0-9]+]]:_(<4 x s16>) = G_IMPLICIT_DEF
870    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT]](<3 x s16>), 0
871    ; CHECK: [[INSERT1:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[INSERT]], [[TRUNC]](s16), 16
872    ; CHECK: [[EXTRACT1:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[INSERT1]](<4 x s16>), 0
873    ; CHECK: [[INSERT2:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT1]](<3 x s16>), 0
874    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT2]](<4 x s16>)
875    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
876    %1:_(<3 x s16>) = G_EXTRACT %0, 0
877    %2:_(s32) = COPY $vgpr2
878    %3:_(s16) = G_TRUNC %2
879    %4:_(<3 x s16>) = G_INSERT %1, %3, 16
880    %5:_(<4 x s16>) = G_IMPLICIT_DEF
881    %6:_(<4 x s16>) = G_INSERT %5, %4, 0
882    $vgpr0_vgpr1 = COPY %6
883...
884---
885name: test_insert_v3s16_s16_offset32
886body: |
887  bb.0:
888    liveins: $vgpr0_vgpr1, $vgpr2
889
890    ; CHECK-LABEL: name: test_insert_v3s16_s16_offset32
891    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
892    ; CHECK: [[EXTRACT:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[COPY]](<4 x s16>), 0
893    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
894    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
895    ; CHECK: [[DEF:%[0-9]+]]:_(<4 x s16>) = G_IMPLICIT_DEF
896    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT]](<3 x s16>), 0
897    ; CHECK: [[INSERT1:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[INSERT]], [[TRUNC]](s16), 32
898    ; CHECK: [[EXTRACT1:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[INSERT1]](<4 x s16>), 0
899    ; CHECK: [[INSERT2:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT1]](<3 x s16>), 0
900    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT2]](<4 x s16>)
901    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
902    %1:_(<3 x s16>) = G_EXTRACT %0, 0
903    %2:_(s32) = COPY $vgpr2
904    %3:_(s16) = G_TRUNC %2
905    %4:_(<3 x s16>) = G_INSERT %1, %3, 32
906    %5:_(<4 x s16>) = G_IMPLICIT_DEF
907    %6:_(<4 x s16>) = G_INSERT %5, %4, 0
908    $vgpr0_vgpr1 = COPY %6
909...
910---
911name: test_insert_v3s16_v2s16_offset0
912body: |
913  bb.0:
914    liveins: $vgpr0_vgpr1, $vgpr2
915
916    ; CHECK-LABEL: name: test_insert_v3s16_v2s16_offset0
917    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
918    ; CHECK: [[EXTRACT:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[COPY]](<4 x s16>), 0
919    ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr2
920    ; CHECK: [[DEF:%[0-9]+]]:_(<4 x s16>) = G_IMPLICIT_DEF
921    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT]](<3 x s16>), 0
922    ; CHECK: [[INSERT1:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[INSERT]], [[COPY1]](<2 x s16>), 0
923    ; CHECK: [[EXTRACT1:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[INSERT1]](<4 x s16>), 0
924    ; CHECK: [[INSERT2:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT1]](<3 x s16>), 0
925    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT2]](<4 x s16>)
926    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
927    %1:_(<3 x s16>) = G_EXTRACT %0, 0
928    %2:_(<2 x s16>) = COPY $vgpr2
929    %4:_(<3 x s16>) = G_INSERT %1, %2, 0
930    %5:_(<4 x s16>) = G_IMPLICIT_DEF
931    %6:_(<4 x s16>) = G_INSERT %5, %4, 0
932    $vgpr0_vgpr1 = COPY %6
933...
934---
935name: test_insert_v3s16_v2s16_offset16
936body: |
937  bb.0:
938    liveins: $vgpr0_vgpr1, $vgpr2
939
940    ; CHECK-LABEL: name: test_insert_v3s16_v2s16_offset16
941    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
942    ; CHECK: [[EXTRACT:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[COPY]](<4 x s16>), 0
943    ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr2
944    ; CHECK: [[DEF:%[0-9]+]]:_(<4 x s16>) = G_IMPLICIT_DEF
945    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT]](<3 x s16>), 0
946    ; CHECK: [[INSERT1:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[INSERT]], [[COPY1]](<2 x s16>), 16
947    ; CHECK: [[EXTRACT1:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[INSERT1]](<4 x s16>), 0
948    ; CHECK: [[INSERT2:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT1]](<3 x s16>), 0
949    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT2]](<4 x s16>)
950    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
951    %1:_(<3 x s16>) = G_EXTRACT %0, 0
952    %2:_(<2 x s16>) = COPY $vgpr2
953    %4:_(<3 x s16>) = G_INSERT %1, %2, 16
954    %5:_(<4 x s16>) = G_IMPLICIT_DEF
955    %6:_(<4 x s16>) = G_INSERT %5, %4, 0
956    $vgpr0_vgpr1 = COPY %6
957...
958---
959name: test_insert_v3s16_s32_offset0
960body: |
961  bb.0:
962    liveins: $vgpr0_vgpr1, $vgpr2
963
964    ; CHECK-LABEL: name: test_insert_v3s16_s32_offset0
965    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
966    ; CHECK: [[EXTRACT:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[COPY]](<4 x s16>), 0
967    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
968    ; CHECK: [[DEF:%[0-9]+]]:_(<4 x s16>) = G_IMPLICIT_DEF
969    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT]](<3 x s16>), 0
970    ; CHECK: [[INSERT1:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[INSERT]], [[COPY1]](s32), 0
971    ; CHECK: [[EXTRACT1:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[INSERT1]](<4 x s16>), 0
972    ; CHECK: [[INSERT2:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT1]](<3 x s16>), 0
973    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT2]](<4 x s16>)
974    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
975    %1:_(<3 x s16>) = G_EXTRACT %0, 0
976    %2:_(s32) = COPY $vgpr2
977    %4:_(<3 x s16>) = G_INSERT %1, %2, 0
978    %5:_(<4 x s16>) = G_IMPLICIT_DEF
979    %6:_(<4 x s16>) = G_INSERT %5, %4, 0
980    $vgpr0_vgpr1 = COPY %6
981...
982---
983name: test_insert_v3s16_s32_offset16
984body: |
985  bb.0:
986    liveins: $vgpr0_vgpr1, $vgpr2
987
988    ; CHECK-LABEL: name: test_insert_v3s16_s32_offset16
989    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
990    ; CHECK: [[EXTRACT:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[COPY]](<4 x s16>), 0
991    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
992    ; CHECK: [[DEF:%[0-9]+]]:_(<4 x s16>) = G_IMPLICIT_DEF
993    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT]](<3 x s16>), 0
994    ; CHECK: [[INSERT1:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[INSERT]], [[COPY1]](s32), 16
995    ; CHECK: [[EXTRACT1:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[INSERT1]](<4 x s16>), 0
996    ; CHECK: [[INSERT2:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[DEF]], [[EXTRACT1]](<3 x s16>), 0
997    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT2]](<4 x s16>)
998    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
999    %1:_(<3 x s16>) = G_EXTRACT %0, 0
1000    %2:_(s32) = COPY $vgpr2
1001    %4:_(<3 x s16>) = G_INSERT %1, %2, 16
1002    %5:_(<4 x s16>) = G_IMPLICIT_DEF
1003    %6:_(<4 x s16>) = G_INSERT %5, %4, 0
1004    $vgpr0_vgpr1 = COPY %6
1005...
1006---
1007name: test_insert_v4s16_s16_offset0
1008body: |
1009  bb.0:
1010    liveins: $vgpr0_vgpr1, $vgpr2
1011
1012    ; CHECK-LABEL: name: test_insert_v4s16_s16_offset0
1013    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
1014    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
1015    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
1016    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[COPY]], [[TRUNC]](s16), 0
1017    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<4 x s16>)
1018    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
1019    %1:_(s32) = COPY $vgpr2
1020    %2:_(s16) = G_TRUNC %1
1021    %3:_(<4 x s16>) = G_INSERT %0, %2, 0
1022    $vgpr0_vgpr1 = COPY %3
1023...
1024---
1025name: test_insert_v4s16_s16_offset16
1026body: |
1027  bb.0:
1028    liveins: $vgpr0_vgpr1, $vgpr2
1029
1030    ; CHECK-LABEL: name: test_insert_v4s16_s16_offset16
1031    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
1032    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
1033    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
1034    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[COPY]], [[TRUNC]](s16), 16
1035    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<4 x s16>)
1036    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
1037    %1:_(s32) = COPY $vgpr2
1038    %2:_(s16) = G_TRUNC %1
1039    %3:_(<4 x s16>) = G_INSERT %0, %2, 16
1040    $vgpr0_vgpr1 = COPY %3
1041...
1042---
1043name: test_insert_v4s16_s16_offset32
1044body: |
1045  bb.0:
1046    liveins: $vgpr0_vgpr1, $vgpr2
1047
1048    ; CHECK-LABEL: name: test_insert_v4s16_s16_offset32
1049    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
1050    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
1051    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
1052    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[COPY]], [[TRUNC]](s16), 32
1053    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<4 x s16>)
1054    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
1055    %1:_(s32) = COPY $vgpr2
1056    %2:_(s16) = G_TRUNC %1
1057    %3:_(<4 x s16>) = G_INSERT %0, %2, 32
1058    $vgpr0_vgpr1 = COPY %3
1059...
1060---
1061name: test_insert_v4s16_s16_offset48
1062body: |
1063  bb.0:
1064    liveins: $vgpr0_vgpr1, $vgpr2
1065
1066    ; CHECK-LABEL: name: test_insert_v4s16_s16_offset48
1067    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
1068    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
1069    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
1070    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[COPY]], [[TRUNC]](s16), 48
1071    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<4 x s16>)
1072    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
1073    %1:_(s32) = COPY $vgpr2
1074    %2:_(s16) = G_TRUNC %1
1075    %3:_(<4 x s16>) = G_INSERT %0, %2, 48
1076    $vgpr0_vgpr1 = COPY %3
1077...
1078---
1079name: test_insert_v4s16_v2s16_offset0
1080body: |
1081  bb.0:
1082    liveins: $vgpr0_vgpr1, $vgpr2
1083
1084    ; CHECK-LABEL: name: test_insert_v4s16_v2s16_offset0
1085    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
1086    ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr2
1087    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[COPY]], [[COPY1]](<2 x s16>), 0
1088    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<4 x s16>)
1089    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
1090    %1:_(<2 x s16>) = COPY $vgpr2
1091    %2:_(<4 x s16>) = G_INSERT %0, %1, 0
1092    $vgpr0_vgpr1 = COPY %2
1093...
1094---
1095name: test_insert_v4s16_v2s16_offset16
1096body: |
1097  bb.0:
1098    liveins: $vgpr0_vgpr1, $vgpr2
1099
1100    ; CHECK-LABEL: name: test_insert_v4s16_v2s16_offset16
1101    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
1102    ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr2
1103    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[COPY]], [[COPY1]](<2 x s16>), 16
1104    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<4 x s16>)
1105    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
1106    %1:_(<2 x s16>) = COPY $vgpr2
1107    %2:_(<4 x s16>) = G_INSERT %0, %1, 16
1108    $vgpr0_vgpr1 = COPY %2
1109...
1110---
1111name: test_insert_v4s16_v2s16_offset32
1112body: |
1113  bb.0:
1114    liveins: $vgpr0_vgpr1, $vgpr2
1115
1116    ; CHECK-LABEL: name: test_insert_v4s16_v2s16_offset32
1117    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
1118    ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr2
1119    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[COPY]], [[COPY1]](<2 x s16>), 32
1120    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<4 x s16>)
1121    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
1122    %1:_(<2 x s16>) = COPY $vgpr2
1123    %2:_(<4 x s16>) = G_INSERT %0, %1, 32
1124    $vgpr0_vgpr1 = COPY %2
1125...
1126---
1127name: test_insert_v4s16_v3s16_offset0
1128body: |
1129  bb.0:
1130    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
1131
1132    ; CHECK-LABEL: name: test_insert_v4s16_v3s16_offset0
1133    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
1134    ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr2_vgpr3
1135    ; CHECK: [[EXTRACT:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[COPY1]](<4 x s16>), 0
1136    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[COPY]], [[EXTRACT]](<3 x s16>), 0
1137    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<4 x s16>)
1138    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
1139    %1:_(<4 x s16>) = COPY $vgpr2_vgpr3
1140    %2:_(<3 x s16>) = G_EXTRACT %1, 0
1141    %3:_(<4 x s16>) = G_INSERT %0, %2, 0
1142    $vgpr0_vgpr1 = COPY %3
1143...
1144---
1145name: test_insert_v4s16_v3s16_offset16
1146body: |
1147  bb.0:
1148    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
1149
1150    ; CHECK-LABEL: name: test_insert_v4s16_v3s16_offset16
1151    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
1152    ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr2_vgpr3
1153    ; CHECK: [[EXTRACT:%[0-9]+]]:_(<3 x s16>) = G_EXTRACT [[COPY1]](<4 x s16>), 0
1154    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[COPY]], [[EXTRACT]](<3 x s16>), 16
1155    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<4 x s16>)
1156    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
1157    %1:_(<4 x s16>) = COPY $vgpr2_vgpr3
1158    %2:_(<3 x s16>) = G_EXTRACT %1, 0
1159    %3:_(<4 x s16>) = G_INSERT %0, %2, 16
1160    $vgpr0_vgpr1 = COPY %3
1161...
1162---
1163name: test_insert_v4s16_s32_offset0
1164body: |
1165  bb.0:
1166    liveins: $vgpr0_vgpr1, $vgpr2
1167
1168    ; CHECK-LABEL: name: test_insert_v4s16_s32_offset0
1169    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
1170    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
1171    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[COPY]], [[COPY1]](s32), 0
1172    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<4 x s16>)
1173    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
1174    %1:_(s32) = COPY $vgpr2
1175    %2:_(<4 x s16>) = G_INSERT %0, %1, 0
1176    $vgpr0_vgpr1 = COPY %2
1177...
1178---
1179name: test_insert_v4s16_s32_offset16
1180body: |
1181  bb.0:
1182    liveins: $vgpr0_vgpr1, $vgpr2
1183
1184    ; CHECK-LABEL: name: test_insert_v4s16_s32_offset16
1185    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
1186    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
1187    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[COPY]], [[COPY1]](s32), 16
1188    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<4 x s16>)
1189    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
1190    %1:_(s32) = COPY $vgpr2
1191    %2:_(<4 x s16>) = G_INSERT %0, %1, 16
1192    $vgpr0_vgpr1 = COPY %2
1193...
1194---
1195name: test_insert_v4s16_s32_offset32
1196body: |
1197  bb.0:
1198    liveins: $vgpr0_vgpr1, $vgpr2
1199
1200    ; CHECK-LABEL: name: test_insert_v4s16_s32_offset32
1201    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $vgpr0_vgpr1
1202    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
1203    ; CHECK: [[INSERT:%[0-9]+]]:_(<4 x s16>) = G_INSERT [[COPY]], [[COPY1]](s32), 32
1204    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](<4 x s16>)
1205    %0:_(<4 x s16>) = COPY $vgpr0_vgpr1
1206    %1:_(s32) = COPY $vgpr2
1207    %2:_(<4 x s16>) = G_INSERT %0, %1, 32
1208    $vgpr0_vgpr1 = COPY %2
1209...
1210
1211---
1212name: test_insert_s64_s16_offset0
1213body: |
1214  bb.0:
1215    liveins: $vgpr0_vgpr1, $vgpr2
1216
1217    ; CHECK-LABEL: name: test_insert_s64_s16_offset0
1218    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
1219    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
1220    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
1221    ; CHECK: [[INSERT:%[0-9]+]]:_(s64) = G_INSERT [[COPY]], [[TRUNC]](s16), 0
1222    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](s64)
1223    %0:_(s64) = COPY $vgpr0_vgpr1
1224    %1:_(s32) = COPY $vgpr2
1225    %2:_(s16) = G_TRUNC %1
1226    %3:_(s64) = G_INSERT %0, %2, 0
1227    $vgpr0_vgpr1 = COPY %3
1228...
1229---
1230name: test_insert_s64_s16_offset16
1231body: |
1232  bb.0:
1233    liveins: $vgpr0_vgpr1, $vgpr2
1234
1235    ; CHECK-LABEL: name: test_insert_s64_s16_offset16
1236    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
1237    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
1238    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
1239    ; CHECK: [[INSERT:%[0-9]+]]:_(s64) = G_INSERT [[COPY]], [[TRUNC]](s16), 16
1240    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](s64)
1241    %0:_(s64) = COPY $vgpr0_vgpr1
1242    %1:_(s32) = COPY $vgpr2
1243    %2:_(s16) = G_TRUNC %1
1244    %3:_(s64) = G_INSERT %0, %2, 16
1245    $vgpr0_vgpr1 = COPY %3
1246...
1247---
1248name: test_insert_s64_s16_offset32
1249body: |
1250  bb.0:
1251    liveins: $vgpr0_vgpr1, $vgpr2
1252
1253    ; CHECK-LABEL: name: test_insert_s64_s16_offset32
1254    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
1255    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
1256    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
1257    ; CHECK: [[INSERT:%[0-9]+]]:_(s64) = G_INSERT [[COPY]], [[TRUNC]](s16), 32
1258    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](s64)
1259    %0:_(s64) = COPY $vgpr0_vgpr1
1260    %1:_(s32) = COPY $vgpr2
1261    %2:_(s16) = G_TRUNC %1
1262    %3:_(s64) = G_INSERT %0, %2, 32
1263    $vgpr0_vgpr1 = COPY %3
1264...
1265---
1266name: test_insert_s64_s16_offset48
1267body: |
1268  bb.0:
1269    liveins: $vgpr0_vgpr1, $vgpr2
1270
1271    ; CHECK-LABEL: name: test_insert_s64_s16_offset48
1272    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
1273    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
1274    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
1275    ; CHECK: [[INSERT:%[0-9]+]]:_(s64) = G_INSERT [[COPY]], [[TRUNC]](s16), 48
1276    ; CHECK: $vgpr0_vgpr1 = COPY [[INSERT]](s64)
1277    %0:_(s64) = COPY $vgpr0_vgpr1
1278    %1:_(s32) = COPY $vgpr2
1279    %2:_(s16) = G_TRUNC %1
1280    %3:_(s64) = G_INSERT %0, %2, 48
1281    $vgpr0_vgpr1 = COPY %3
1282...
1283---
1284name: test_insert_s32_s16_offset0
1285body: |
1286  bb.0:
1287    liveins: $vgpr0, $vgpr1
1288
1289    ; CHECK-LABEL: name: test_insert_s32_s16_offset0
1290    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
1291    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
1292    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
1293    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
1294    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
1295    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -65536
1296    ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]]
1297    ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND1]], [[AND]]
1298    ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[OR]](s32)
1299    ; CHECK: $vgpr0 = COPY [[COPY3]](s32)
1300    %0:_(s32) = COPY $vgpr0
1301    %1:_(s32) = COPY $vgpr1
1302    %2:_(s16) = G_TRUNC %1
1303    %3:_(s32) = G_INSERT %1, %2, 0
1304    $vgpr0 = COPY %3
1305...
1306
1307---
1308name: test_insert_s32_s16_offset1
1309body: |
1310  bb.0:
1311    liveins: $vgpr0, $vgpr1
1312
1313    ; CHECK-LABEL: name: test_insert_s32_s16_offset1
1314    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
1315    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
1316    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
1317    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
1318    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
1319    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
1320    ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND]], [[C1]](s32)
1321    ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -131071
1322    ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C2]]
1323    ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND1]], [[SHL]]
1324    ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[OR]](s32)
1325    ; CHECK: $vgpr0 = COPY [[COPY3]](s32)
1326    %0:_(s32) = COPY $vgpr0
1327    %1:_(s32) = COPY $vgpr1
1328    %2:_(s16) = G_TRUNC %1
1329    %3:_(s32) = G_INSERT %1, %2, 1
1330    $vgpr0 = COPY %3
1331...
1332
1333---
1334name: test_insert_s32_s16_offset8
1335body: |
1336  bb.0:
1337    liveins: $vgpr0, $vgpr1
1338
1339    ; CHECK-LABEL: name: test_insert_s32_s16_offset8
1340    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
1341    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
1342    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
1343    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
1344    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
1345    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
1346    ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND]], [[C1]](s32)
1347    ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 -16776961
1348    ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C2]]
1349    ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND1]], [[SHL]]
1350    ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[OR]](s32)
1351    ; CHECK: $vgpr0 = COPY [[COPY3]](s32)
1352    %0:_(s32) = COPY $vgpr0
1353    %1:_(s32) = COPY $vgpr1
1354    %2:_(s16) = G_TRUNC %1
1355    %3:_(s32) = G_INSERT %1, %2, 8
1356    $vgpr0 = COPY %3
1357...
1358
1359---
1360name: test_insert_s32_s16_offset16
1361body: |
1362  bb.0:
1363    liveins: $vgpr0, $vgpr1
1364
1365    ; CHECK-LABEL: name: test_insert_s32_s16_offset16
1366    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
1367    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
1368    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
1369    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
1370    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
1371    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
1372    ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND]], [[C1]](s32)
1373    ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
1374    ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND1]], [[SHL]]
1375    ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[OR]](s32)
1376    ; CHECK: $vgpr0 = COPY [[COPY3]](s32)
1377    %0:_(s32) = COPY $vgpr0
1378    %1:_(s32) = COPY $vgpr1
1379    %2:_(s16) = G_TRUNC %1
1380    %3:_(s32) = G_INSERT %1, %2, 16
1381    $vgpr0 = COPY %3
1382...
1383