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 3 4--- 5 6name: sext_inreg_sgpr_s32_1 7legalized: true 8regBankSelected: true 9body: | 10 bb.0: 11 liveins: $sgpr0 12 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... 23 24--- 25 26name: sext_inreg_sgpr_s32_2 27legalized: true 28regBankSelected: true 29body: | 30 bb.0: 31 liveins: $sgpr0 32 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... 43 44--- 45 46name: sext_inreg_sgpr_s32_8 47legalized: true 48regBankSelected: true 49body: | 50 bb.0: 51 liveins: $sgpr0 52 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... 63 64--- 65 66name: sext_inreg_sgpr_s32_16 67legalized: true 68regBankSelected: true 69body: | 70 bb.0: 71 liveins: $sgpr0 72 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... 83 84--- 85 86name: sext_inreg_sgpr_s32_31 87legalized: true 88regBankSelected: true 89body: | 90 bb.0: 91 liveins: $sgpr0 92 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 102... 103 104--- 105 106name: sext_inreg_sgpr_s64_1 107legalized: true 108regBankSelected: true 109body: | 110 bb.0: 111 liveins: $sgpr0_sgpr1 112 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 124... 125 126--- 127 128name: sext_inreg_sgpr_s64_2 129legalized: true 130regBankSelected: true 131body: | 132 bb.0: 133 liveins: $sgpr0_sgpr1 134 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 146... 147 148--- 149 150name: sext_inreg_sgpr_s64_8 151legalized: true 152regBankSelected: true 153body: | 154 bb.0: 155 liveins: $sgpr0_sgpr1 156 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 168... 169 170--- 171 172name: sext_inreg_sgpr_s64_16 173legalized: true 174regBankSelected: true 175body: | 176 bb.0: 177 liveins: $sgpr0_sgpr1 178 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 190... 191 192--- 193 194name: sext_inreg_sgpr_s64_31 195legalized: true 196regBankSelected: true 197body: | 198 bb.0: 199 liveins: $sgpr0_sgpr1 200 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 212... 213 214# Ideally this degenerate case would have been replaceed with a 32-bit shift by combines. 215--- 216 217name: sext_inreg_sgpr_s64_32 218legalized: true 219regBankSelected: true 220body: | 221 bb.0: 222 liveins: $sgpr0_sgpr1 223 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 234... 235 236--- 237 238name: sext_inreg_sgpr_s64_63 239legalized: true 240regBankSelected: true 241body: | 242 bb.0: 243 liveins: $sgpr0_sgpr1 244 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 256... 257 258--- 259 260name: sext_inreg_vgpr_s32_1 261legalized: true 262regBankSelected: true 263body: | 264 bb.0: 265 liveins: $vgpr0 266 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 276... 277 278--- 279 280name: sext_inreg_vgpr_s32_2 281legalized: true 282regBankSelected: true 283body: | 284 bb.0: 285 liveins: $vgpr0 286 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 296... 297 298--- 299 300name: sext_inreg_vgpr_s32_8 301legalized: true 302regBankSelected: true 303body: | 304 bb.0: 305 liveins: $vgpr0 306 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 316... 317 318--- 319 320name: sext_inreg_vgpr_s32_16 321legalized: true 322regBankSelected: true 323body: | 324 bb.0: 325 liveins: $vgpr0 326 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 336... 337 338--- 339 340name: sext_inreg_vgpr_s32_31 341legalized: true 342regBankSelected: true 343body: | 344 bb.0: 345 liveins: $vgpr0 346 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 356... 357