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
6 name: sext_inreg_sgpr_s32_1
13 ; GCN-LABEL: name: sext_inreg_sgpr_s32_1
14 ; GCN: liveins: $sgpr0
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
26 name: sext_inreg_sgpr_s32_2
33 ; GCN-LABEL: name: sext_inreg_sgpr_s32_2
34 ; GCN: liveins: $sgpr0
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
46 name: sext_inreg_sgpr_s32_8
53 ; GCN-LABEL: name: sext_inreg_sgpr_s32_8
54 ; GCN: liveins: $sgpr0
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
66 name: sext_inreg_sgpr_s32_16
73 ; GCN-LABEL: name: sext_inreg_sgpr_s32_16
74 ; GCN: liveins: $sgpr0
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
86 name: sext_inreg_sgpr_s32_31
93 ; GCN-LABEL: name: sext_inreg_sgpr_s32_31
94 ; GCN: liveins: $sgpr0
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
106 name: sext_inreg_sgpr_s64_1
108 regBankSelected: true
111 liveins: $sgpr0_sgpr1
113 ; GCN-LABEL: name: sext_inreg_sgpr_s64_1
114 ; GCN: liveins: $sgpr0_sgpr1
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
130 regBankSelected: true
133 liveins: $sgpr0_sgpr1
135 ; GCN-LABEL: name: sext_inreg_sgpr_s64_2
136 ; GCN: liveins: $sgpr0_sgpr1
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
152 regBankSelected: true
155 liveins: $sgpr0_sgpr1
157 ; GCN-LABEL: name: sext_inreg_sgpr_s64_8
158 ; GCN: liveins: $sgpr0_sgpr1
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
174 regBankSelected: true
177 liveins: $sgpr0_sgpr1
179 ; GCN-LABEL: name: sext_inreg_sgpr_s64_16
180 ; GCN: liveins: $sgpr0_sgpr1
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
196 regBankSelected: true
199 liveins: $sgpr0_sgpr1
201 ; GCN-LABEL: name: sext_inreg_sgpr_s64_31
202 ; GCN: liveins: $sgpr0_sgpr1
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
219 regBankSelected: true
222 liveins: $sgpr0_sgpr1
224 ; GCN-LABEL: name: sext_inreg_sgpr_s64_32
225 ; GCN: liveins: $sgpr0_sgpr1
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
240 regBankSelected: true
243 liveins: $sgpr0_sgpr1
245 ; GCN-LABEL: name: sext_inreg_sgpr_s64_63
246 ; GCN: liveins: $sgpr0_sgpr1
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
262 regBankSelected: true
267 ; GCN-LABEL: name: sext_inreg_vgpr_s32_1
268 ; GCN: liveins: $vgpr0
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
280 name: sext_inreg_vgpr_s32_2
282 regBankSelected: true
287 ; GCN-LABEL: name: sext_inreg_vgpr_s32_2
288 ; GCN: liveins: $vgpr0
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
300 name: sext_inreg_vgpr_s32_8
302 regBankSelected: true
307 ; GCN-LABEL: name: sext_inreg_vgpr_s32_8
308 ; GCN: liveins: $vgpr0
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
320 name: sext_inreg_vgpr_s32_16
322 regBankSelected: true
327 ; GCN-LABEL: name: sext_inreg_vgpr_s32_16
328 ; GCN: liveins: $vgpr0
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
340 name: sext_inreg_vgpr_s32_31
342 regBankSelected: true
347 ; GCN-LABEL: name: sext_inreg_vgpr_s32_31
348 ; GCN: liveins: $vgpr0
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