Bump version to 19.1.0-rc3
[llvm-project.git] / llvm / test / CodeGen / AMDGPU / GlobalISel / inst-select-sext-inreg.mir
blob38218ec23c44ad38b436d134a76181719821dc9c
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -mcpu=tahiti -run-pass=instruction-select -verify-machineinstrs -global-isel %s -o - | FileCheck -check-prefix=GCN %s
4 ---
6 name: sext_inreg_sgpr_s32_1
7 legalized:       true
8 regBankSelected: true
9 body: |
10   bb.0:
11     liveins: $sgpr0
13     ; GCN-LABEL: name: sext_inreg_sgpr_s32_1
14     ; GCN: liveins: $sgpr0
15     ; GCN-NEXT: {{  $}}
16     ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
17     ; GCN-NEXT: [[S_BFE_I32_:%[0-9]+]]:sreg_32 = S_BFE_I32 [[COPY]], 65536, implicit-def $scc
18     ; GCN-NEXT: $sgpr0 = COPY [[S_BFE_I32_]]
19     %0:sgpr(s32) = COPY $sgpr0
20     %1:sgpr(s32) = G_SEXT_INREG %0, 1
21     $sgpr0 = COPY %1
22 ...
24 ---
26 name: sext_inreg_sgpr_s32_2
27 legalized:       true
28 regBankSelected: true
29 body: |
30   bb.0:
31     liveins: $sgpr0
33     ; GCN-LABEL: name: sext_inreg_sgpr_s32_2
34     ; GCN: liveins: $sgpr0
35     ; GCN-NEXT: {{  $}}
36     ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
37     ; GCN-NEXT: [[S_BFE_I32_:%[0-9]+]]:sreg_32 = S_BFE_I32 [[COPY]], 131072, implicit-def $scc
38     ; GCN-NEXT: $sgpr0 = COPY [[S_BFE_I32_]]
39     %0:sgpr(s32) = COPY $sgpr0
40     %1:sgpr(s32) = G_SEXT_INREG %0, 2
41     $sgpr0 = COPY %1
42 ...
44 ---
46 name: sext_inreg_sgpr_s32_8
47 legalized:       true
48 regBankSelected: true
49 body: |
50   bb.0:
51     liveins: $sgpr0
53     ; GCN-LABEL: name: sext_inreg_sgpr_s32_8
54     ; GCN: liveins: $sgpr0
55     ; GCN-NEXT: {{  $}}
56     ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
57     ; GCN-NEXT: [[S_SEXT_I32_I8_:%[0-9]+]]:sreg_32 = S_SEXT_I32_I8 [[COPY]]
58     ; GCN-NEXT: $sgpr0 = COPY [[S_SEXT_I32_I8_]]
59     %0:sgpr(s32) = COPY $sgpr0
60     %1:sgpr(s32) = G_SEXT_INREG %0, 8
61     $sgpr0 = COPY %1
62 ...
64 ---
66 name: sext_inreg_sgpr_s32_16
67 legalized:       true
68 regBankSelected: true
69 body: |
70   bb.0:
71     liveins: $sgpr0
73     ; GCN-LABEL: name: sext_inreg_sgpr_s32_16
74     ; GCN: liveins: $sgpr0
75     ; GCN-NEXT: {{  $}}
76     ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
77     ; GCN-NEXT: [[S_SEXT_I32_I16_:%[0-9]+]]:sreg_32 = S_SEXT_I32_I16 [[COPY]]
78     ; GCN-NEXT: $sgpr0 = COPY [[S_SEXT_I32_I16_]]
79     %0:sgpr(s32) = COPY $sgpr0
80     %1:sgpr(s32) = G_SEXT_INREG %0, 16
81     $sgpr0 = COPY %1
82 ...
84 ---
86 name: sext_inreg_sgpr_s32_31
87 legalized:       true
88 regBankSelected: true
89 body: |
90   bb.0:
91     liveins: $sgpr0
93     ; GCN-LABEL: name: sext_inreg_sgpr_s32_31
94     ; GCN: liveins: $sgpr0
95     ; GCN-NEXT: {{  $}}
96     ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
97     ; GCN-NEXT: [[S_BFE_I32_:%[0-9]+]]:sreg_32 = S_BFE_I32 [[COPY]], 2031616, implicit-def $scc
98     ; GCN-NEXT: $sgpr0 = COPY [[S_BFE_I32_]]
99     %0:sgpr(s32) = COPY $sgpr0
100     %1:sgpr(s32) = G_SEXT_INREG %0, 31
101     $sgpr0 = COPY %1
106 name: sext_inreg_sgpr_s64_1
107 legalized:       true
108 regBankSelected: true
109 body: |
110   bb.0:
111     liveins: $sgpr0_sgpr1
113     ; GCN-LABEL: name: sext_inreg_sgpr_s64_1
114     ; GCN: liveins: $sgpr0_sgpr1
115     ; GCN-NEXT: {{  $}}
116     ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
117     ; GCN-NEXT: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
118     ; GCN-NEXT: [[REG_SEQUENCE:%[0-9]+]]:sreg_64 = REG_SEQUENCE [[COPY]].sub0, %subreg.sub0, [[DEF]], %subreg.sub1
119     ; GCN-NEXT: [[S_BFE_I64_:%[0-9]+]]:sreg_64 = S_BFE_I64 [[REG_SEQUENCE]], 65536, implicit-def $scc
120     ; GCN-NEXT: $sgpr0_sgpr1 = COPY [[S_BFE_I64_]]
121     %0:sgpr(s64) = COPY $sgpr0_sgpr1
122     %1:sgpr(s64) = G_SEXT_INREG %0, 1
123     $sgpr0_sgpr1 = COPY %1
128 name: sext_inreg_sgpr_s64_2
129 legalized:       true
130 regBankSelected: true
131 body: |
132   bb.0:
133     liveins: $sgpr0_sgpr1
135     ; GCN-LABEL: name: sext_inreg_sgpr_s64_2
136     ; GCN: liveins: $sgpr0_sgpr1
137     ; GCN-NEXT: {{  $}}
138     ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
139     ; GCN-NEXT: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
140     ; GCN-NEXT: [[REG_SEQUENCE:%[0-9]+]]:sreg_64 = REG_SEQUENCE [[COPY]].sub0, %subreg.sub0, [[DEF]], %subreg.sub1
141     ; GCN-NEXT: [[S_BFE_I64_:%[0-9]+]]:sreg_64 = S_BFE_I64 [[REG_SEQUENCE]], 131072, implicit-def $scc
142     ; GCN-NEXT: $sgpr0_sgpr1 = COPY [[S_BFE_I64_]]
143     %0:sgpr(s64) = COPY $sgpr0_sgpr1
144     %1:sgpr(s64) = G_SEXT_INREG %0, 2
145     $sgpr0_sgpr1 = COPY %1
150 name: sext_inreg_sgpr_s64_8
151 legalized:       true
152 regBankSelected: true
153 body: |
154   bb.0:
155     liveins: $sgpr0_sgpr1
157     ; GCN-LABEL: name: sext_inreg_sgpr_s64_8
158     ; GCN: liveins: $sgpr0_sgpr1
159     ; GCN-NEXT: {{  $}}
160     ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
161     ; GCN-NEXT: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
162     ; GCN-NEXT: [[REG_SEQUENCE:%[0-9]+]]:sreg_64 = REG_SEQUENCE [[COPY]].sub0, %subreg.sub0, [[DEF]], %subreg.sub1
163     ; GCN-NEXT: [[S_BFE_I64_:%[0-9]+]]:sreg_64 = S_BFE_I64 [[REG_SEQUENCE]], 524288, implicit-def $scc
164     ; GCN-NEXT: $sgpr0_sgpr1 = COPY [[S_BFE_I64_]]
165     %0:sgpr(s64) = COPY $sgpr0_sgpr1
166     %1:sgpr(s64) = G_SEXT_INREG %0, 8
167     $sgpr0_sgpr1 = COPY %1
172 name: sext_inreg_sgpr_s64_16
173 legalized:       true
174 regBankSelected: true
175 body: |
176   bb.0:
177     liveins: $sgpr0_sgpr1
179     ; GCN-LABEL: name: sext_inreg_sgpr_s64_16
180     ; GCN: liveins: $sgpr0_sgpr1
181     ; GCN-NEXT: {{  $}}
182     ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
183     ; GCN-NEXT: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
184     ; GCN-NEXT: [[REG_SEQUENCE:%[0-9]+]]:sreg_64 = REG_SEQUENCE [[COPY]].sub0, %subreg.sub0, [[DEF]], %subreg.sub1
185     ; GCN-NEXT: [[S_BFE_I64_:%[0-9]+]]:sreg_64 = S_BFE_I64 [[REG_SEQUENCE]], 1048576, implicit-def $scc
186     ; GCN-NEXT: $sgpr0_sgpr1 = COPY [[S_BFE_I64_]]
187     %0:sgpr(s64) = COPY $sgpr0_sgpr1
188     %1:sgpr(s64) = G_SEXT_INREG %0, 16
189     $sgpr0_sgpr1 = COPY %1
194 name: sext_inreg_sgpr_s64_31
195 legalized:       true
196 regBankSelected: true
197 body: |
198   bb.0:
199     liveins: $sgpr0_sgpr1
201     ; GCN-LABEL: name: sext_inreg_sgpr_s64_31
202     ; GCN: liveins: $sgpr0_sgpr1
203     ; GCN-NEXT: {{  $}}
204     ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
205     ; GCN-NEXT: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
206     ; GCN-NEXT: [[REG_SEQUENCE:%[0-9]+]]:sreg_64 = REG_SEQUENCE [[COPY]].sub0, %subreg.sub0, [[DEF]], %subreg.sub1
207     ; GCN-NEXT: [[S_BFE_I64_:%[0-9]+]]:sreg_64 = S_BFE_I64 [[REG_SEQUENCE]], 2031616, implicit-def $scc
208     ; GCN-NEXT: $sgpr0_sgpr1 = COPY [[S_BFE_I64_]]
209     %0:sgpr(s64) = COPY $sgpr0_sgpr1
210     %1:sgpr(s64) = G_SEXT_INREG %0, 31
211     $sgpr0_sgpr1 = COPY %1
214 # Ideally this degenerate case would have been replaceed with a 32-bit shift by combines.
217 name: sext_inreg_sgpr_s64_32
218 legalized:       true
219 regBankSelected: true
220 body: |
221   bb.0:
222     liveins: $sgpr0_sgpr1
224     ; GCN-LABEL: name: sext_inreg_sgpr_s64_32
225     ; GCN: liveins: $sgpr0_sgpr1
226     ; GCN-NEXT: {{  $}}
227     ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
228     ; GCN-NEXT: [[S_ASHR_I32_:%[0-9]+]]:sreg_32 = S_ASHR_I32 [[COPY]].sub0, 31, implicit-def dead $scc
229     ; GCN-NEXT: [[REG_SEQUENCE:%[0-9]+]]:sreg_64 = REG_SEQUENCE [[COPY]].sub0, %subreg.sub0, [[S_ASHR_I32_]], %subreg.sub1
230     ; GCN-NEXT: $sgpr0_sgpr1 = COPY [[REG_SEQUENCE]]
231     %0:sgpr(s64) = COPY $sgpr0_sgpr1
232     %1:sgpr(s64) = G_SEXT_INREG %0, 32
233     $sgpr0_sgpr1 = COPY %1
238 name: sext_inreg_sgpr_s64_63
239 legalized:       true
240 regBankSelected: true
241 body: |
242   bb.0:
243     liveins: $sgpr0_sgpr1
245     ; GCN-LABEL: name: sext_inreg_sgpr_s64_63
246     ; GCN: liveins: $sgpr0_sgpr1
247     ; GCN-NEXT: {{  $}}
248     ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1
249     ; GCN-NEXT: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
250     ; GCN-NEXT: [[REG_SEQUENCE:%[0-9]+]]:sreg_64 = REG_SEQUENCE [[COPY]].sub0, %subreg.sub0, [[DEF]], %subreg.sub1
251     ; GCN-NEXT: [[S_BFE_I64_:%[0-9]+]]:sreg_64 = S_BFE_I64 [[REG_SEQUENCE]], 4128768, implicit-def $scc
252     ; GCN-NEXT: $sgpr0_sgpr1 = COPY [[S_BFE_I64_]]
253     %0:sgpr(s64) = COPY $sgpr0_sgpr1
254     %1:sgpr(s64) = G_SEXT_INREG %0, 63
255     $sgpr0_sgpr1 = COPY %1
260 name: sext_inreg_vgpr_s32_1
261 legalized:       true
262 regBankSelected: true
263 body: |
264   bb.0:
265     liveins: $vgpr0
267     ; GCN-LABEL: name: sext_inreg_vgpr_s32_1
268     ; GCN: liveins: $vgpr0
269     ; GCN-NEXT: {{  $}}
270     ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
271     ; GCN-NEXT: [[V_BFE_I32_e64_:%[0-9]+]]:vgpr_32 = V_BFE_I32_e64 [[COPY]], 0, 1, implicit $exec
272     ; GCN-NEXT: $vgpr0 = COPY [[V_BFE_I32_e64_]]
273     %0:vgpr(s32) = COPY $vgpr0
274     %1:vgpr(s32) = G_SEXT_INREG %0, 1
275     $vgpr0 = COPY %1
280 name: sext_inreg_vgpr_s32_2
281 legalized:       true
282 regBankSelected: true
283 body: |
284   bb.0:
285     liveins: $vgpr0
287     ; GCN-LABEL: name: sext_inreg_vgpr_s32_2
288     ; GCN: liveins: $vgpr0
289     ; GCN-NEXT: {{  $}}
290     ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
291     ; GCN-NEXT: [[V_BFE_I32_e64_:%[0-9]+]]:vgpr_32 = V_BFE_I32_e64 [[COPY]], 0, 2, implicit $exec
292     ; GCN-NEXT: $vgpr0 = COPY [[V_BFE_I32_e64_]]
293     %0:vgpr(s32) = COPY $vgpr0
294     %1:vgpr(s32) = G_SEXT_INREG %0, 2
295     $vgpr0 = COPY %1
300 name: sext_inreg_vgpr_s32_8
301 legalized:       true
302 regBankSelected: true
303 body: |
304   bb.0:
305     liveins: $vgpr0
307     ; GCN-LABEL: name: sext_inreg_vgpr_s32_8
308     ; GCN: liveins: $vgpr0
309     ; GCN-NEXT: {{  $}}
310     ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
311     ; GCN-NEXT: [[V_BFE_I32_e64_:%[0-9]+]]:vgpr_32 = V_BFE_I32_e64 [[COPY]], 0, 8, implicit $exec
312     ; GCN-NEXT: $vgpr0 = COPY [[V_BFE_I32_e64_]]
313     %0:vgpr(s32) = COPY $vgpr0
314     %1:vgpr(s32) = G_SEXT_INREG %0, 8
315     $vgpr0 = COPY %1
320 name: sext_inreg_vgpr_s32_16
321 legalized:       true
322 regBankSelected: true
323 body: |
324   bb.0:
325     liveins: $vgpr0
327     ; GCN-LABEL: name: sext_inreg_vgpr_s32_16
328     ; GCN: liveins: $vgpr0
329     ; GCN-NEXT: {{  $}}
330     ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
331     ; GCN-NEXT: [[V_BFE_I32_e64_:%[0-9]+]]:vgpr_32 = V_BFE_I32_e64 [[COPY]], 0, 16, implicit $exec
332     ; GCN-NEXT: $vgpr0 = COPY [[V_BFE_I32_e64_]]
333     %0:vgpr(s32) = COPY $vgpr0
334     %1:vgpr(s32) = G_SEXT_INREG %0, 16
335     $vgpr0 = COPY %1
340 name: sext_inreg_vgpr_s32_31
341 legalized:       true
342 regBankSelected: true
343 body: |
344   bb.0:
345     liveins: $vgpr0
347     ; GCN-LABEL: name: sext_inreg_vgpr_s32_31
348     ; GCN: liveins: $vgpr0
349     ; GCN-NEXT: {{  $}}
350     ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
351     ; GCN-NEXT: [[V_BFE_I32_e64_:%[0-9]+]]:vgpr_32 = V_BFE_I32_e64 [[COPY]], 0, 31, implicit $exec
352     ; GCN-NEXT: $vgpr0 = COPY [[V_BFE_I32_e64_]]
353     %0:vgpr(s32) = COPY $vgpr0
354     %1:vgpr(s32) = G_SEXT_INREG %0, 31
355     $vgpr0 = COPY %1