1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -march=amdgcn -run-pass=instruction-select -verify-machineinstrs -o - %s | FileCheck %s 3--- 4name: extract512 5legalized: true 6regBankSelected: true 7 8body: | 9 bb.0: 10 ; CHECK-LABEL: name: extract512 11 ; CHECK: [[DEF:%[0-9]+]]:sgpr_512 = IMPLICIT_DEF 12 ; CHECK: [[COPY:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub0 13 ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub1 14 ; CHECK: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub2 15 ; CHECK: [[COPY3:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub3 16 ; CHECK: [[COPY4:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub4 17 ; CHECK: [[COPY5:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub5 18 ; CHECK: [[COPY6:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub6 19 ; CHECK: [[COPY7:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub7 20 ; CHECK: [[COPY8:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub8 21 ; CHECK: [[COPY9:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub9 22 ; CHECK: [[COPY10:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub10 23 ; CHECK: [[COPY11:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub11 24 ; CHECK: [[COPY12:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub12 25 ; CHECK: [[COPY13:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub13 26 ; CHECK: [[COPY14:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub14 27 ; CHECK: [[COPY15:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub15 28 ; CHECK: $sgpr0 = COPY [[COPY]] 29 ; CHECK: $sgpr1 = COPY [[COPY1]] 30 ; CHECK: $sgpr2 = COPY [[COPY2]] 31 ; CHECK: $sgpr3 = COPY [[COPY3]] 32 ; CHECK: $sgpr4 = COPY [[COPY4]] 33 ; CHECK: $sgpr5 = COPY [[COPY5]] 34 ; CHECK: $sgpr6 = COPY [[COPY6]] 35 ; CHECK: $sgpr7 = COPY [[COPY7]] 36 ; CHECK: $sgpr8 = COPY [[COPY8]] 37 ; CHECK: $sgpr9 = COPY [[COPY9]] 38 ; CHECK: $sgpr10 = COPY [[COPY10]] 39 ; CHECK: $sgpr11 = COPY [[COPY11]] 40 ; CHECK: $sgpr12 = COPY [[COPY12]] 41 ; CHECK: $sgpr13 = COPY [[COPY13]] 42 ; CHECK: $sgpr14 = COPY [[COPY14]] 43 ; CHECK: $sgpr15 = COPY [[COPY15]] 44 ; CHECK: SI_RETURN_TO_EPILOG $sgpr0, $sgpr1, $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $sgpr7, $sgpr8, $sgpr9, $sgpr10, $sgpr11, $sgpr12, $sgpr13, $sgpr14, $sgpr15 45 %0:sgpr(s512) = G_IMPLICIT_DEF 46 %1:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 0 47 %2:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 32 48 %3:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 64 49 %4:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 96 50 %5:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 128 51 %6:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 160 52 %7:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 192 53 %8:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 224 54 %9:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 256 55 %10:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 288 56 %11:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 320 57 %12:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 352 58 %13:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 384 59 %14:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 416 60 %15:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 448 61 %16:sgpr(s32) = G_EXTRACT %0:sgpr(s512), 480 62 $sgpr0 = COPY %1:sgpr(s32) 63 $sgpr1 = COPY %2:sgpr(s32) 64 $sgpr2 = COPY %3:sgpr(s32) 65 $sgpr3 = COPY %4:sgpr(s32) 66 $sgpr4 = COPY %5:sgpr(s32) 67 $sgpr5 = COPY %6:sgpr(s32) 68 $sgpr6 = COPY %7:sgpr(s32) 69 $sgpr7 = COPY %8:sgpr(s32) 70 $sgpr8 = COPY %9:sgpr(s32) 71 $sgpr9 = COPY %10:sgpr(s32) 72 $sgpr10 = COPY %11:sgpr(s32) 73 $sgpr11 = COPY %12:sgpr(s32) 74 $sgpr12 = COPY %13:sgpr(s32) 75 $sgpr13 = COPY %14:sgpr(s32) 76 $sgpr14 = COPY %15:sgpr(s32) 77 $sgpr15 = COPY %16:sgpr(s32) 78 SI_RETURN_TO_EPILOG $sgpr0, $sgpr1, $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $sgpr7, $sgpr8, $sgpr9, $sgpr10, $sgpr11, $sgpr12, $sgpr13, $sgpr14, $sgpr15 79... 80 81--- 82name: extract_s_s32_s1024 83legalized: true 84regBankSelected: true 85 86body: | 87 bb.0: 88 ; CHECK-LABEL: name: extract_s_s32_s1024 89 ; CHECK: [[DEF:%[0-9]+]]:sgpr_1024 = IMPLICIT_DEF 90 ; CHECK: [[COPY:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub0 91 ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub1 92 ; CHECK: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub2 93 ; CHECK: [[COPY3:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub3 94 ; CHECK: [[COPY4:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub4 95 ; CHECK: [[COPY5:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub5 96 ; CHECK: [[COPY6:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub6 97 ; CHECK: [[COPY7:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub7 98 ; CHECK: [[COPY8:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub8 99 ; CHECK: [[COPY9:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub9 100 ; CHECK: [[COPY10:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub10 101 ; CHECK: [[COPY11:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub11 102 ; CHECK: [[COPY12:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub12 103 ; CHECK: [[COPY13:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub13 104 ; CHECK: [[COPY14:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub14 105 ; CHECK: [[COPY15:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub15 106 ; CHECK: [[COPY16:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub16 107 ; CHECK: [[COPY17:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub17 108 ; CHECK: [[COPY18:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub18 109 ; CHECK: [[COPY19:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub19 110 ; CHECK: [[COPY20:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub20 111 ; CHECK: [[COPY21:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub21 112 ; CHECK: [[COPY22:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub22 113 ; CHECK: [[COPY23:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub23 114 ; CHECK: [[COPY24:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub24 115 ; CHECK: [[COPY25:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub25 116 ; CHECK: [[COPY26:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub26 117 ; CHECK: [[COPY27:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub27 118 ; CHECK: [[COPY28:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub28 119 ; CHECK: [[COPY29:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub29 120 ; CHECK: [[COPY30:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub30 121 ; CHECK: [[COPY31:%[0-9]+]]:sreg_32 = COPY [[DEF]].sub31 122 ; CHECK: S_ENDPGM 0, implicit [[DEF]], implicit [[COPY]], implicit [[COPY1]], implicit [[COPY2]], implicit [[COPY3]], implicit [[COPY4]], implicit [[COPY5]], implicit [[COPY6]], implicit [[COPY7]], implicit [[COPY8]], implicit [[COPY9]], implicit [[COPY10]], implicit [[COPY11]], implicit [[COPY12]], implicit [[COPY13]], implicit [[COPY14]], implicit [[COPY15]], implicit [[COPY16]], implicit [[COPY17]], implicit [[COPY18]], implicit [[COPY19]], implicit [[COPY20]], implicit [[COPY21]], implicit [[COPY22]], implicit [[COPY23]], implicit [[COPY24]], implicit [[COPY25]], implicit [[COPY26]], implicit [[COPY27]], implicit [[COPY28]], implicit [[COPY29]], implicit [[COPY30]], implicit [[COPY31]] 123 %0:sgpr(s1024) = G_IMPLICIT_DEF 124 %1:sgpr(s32) = G_EXTRACT %0:sgpr, 0 125 %2:sgpr(s32) = G_EXTRACT %0:sgpr, 32 126 %3:sgpr(s32) = G_EXTRACT %0:sgpr, 64 127 %4:sgpr(s32) = G_EXTRACT %0:sgpr, 96 128 %5:sgpr(s32) = G_EXTRACT %0:sgpr, 128 129 %6:sgpr(s32) = G_EXTRACT %0:sgpr, 160 130 %7:sgpr(s32) = G_EXTRACT %0:sgpr, 192 131 %8:sgpr(s32) = G_EXTRACT %0:sgpr, 224 132 %9:sgpr(s32) = G_EXTRACT %0:sgpr, 256 133 %10:sgpr(s32) = G_EXTRACT %0:sgpr, 288 134 %11:sgpr(s32) = G_EXTRACT %0:sgpr, 320 135 %12:sgpr(s32) = G_EXTRACT %0:sgpr, 352 136 %13:sgpr(s32) = G_EXTRACT %0:sgpr, 384 137 %14:sgpr(s32) = G_EXTRACT %0:sgpr, 416 138 %15:sgpr(s32) = G_EXTRACT %0:sgpr, 448 139 %16:sgpr(s32) = G_EXTRACT %0:sgpr, 480 140 141 %17:sgpr(s32) = G_EXTRACT %0:sgpr, 512 142 %18:sgpr(s32) = G_EXTRACT %0:sgpr, 544 143 %19:sgpr(s32) = G_EXTRACT %0:sgpr, 576 144 %20:sgpr(s32) = G_EXTRACT %0:sgpr, 608 145 %21:sgpr(s32) = G_EXTRACT %0:sgpr, 640 146 %22:sgpr(s32) = G_EXTRACT %0:sgpr, 672 147 %23:sgpr(s32) = G_EXTRACT %0:sgpr, 704 148 %24:sgpr(s32) = G_EXTRACT %0:sgpr, 736 149 %25:sgpr(s32) = G_EXTRACT %0:sgpr, 768 150 %26:sgpr(s32) = G_EXTRACT %0:sgpr, 800 151 %27:sgpr(s32) = G_EXTRACT %0:sgpr, 832 152 %28:sgpr(s32) = G_EXTRACT %0:sgpr, 864 153 %29:sgpr(s32) = G_EXTRACT %0:sgpr, 896 154 %30:sgpr(s32) = G_EXTRACT %0:sgpr, 928 155 %31:sgpr(s32) = G_EXTRACT %0:sgpr, 960 156 %32:sgpr(s32) = G_EXTRACT %0:sgpr, 992 157 158 S_ENDPGM 0, implicit %0, implicit %1, implicit %2, implicit %3, implicit %4, implicit %5, implicit %6, implicit %7, implicit %8, implicit %9, implicit %10, implicit %11, implicit %12, implicit %13, implicit %14, implicit %15, implicit %16, implicit %17, implicit %18, implicit %19, implicit %20, implicit %21, implicit %22, implicit %23, implicit %24, implicit %25, implicit %26, implicit %27, implicit %28, implicit %29, implicit %30, implicit %31, implicit %32 159... 160 161# TODO: Handle offset 32 162--- 163name: extract_sgpr_s64_from_s128 164legalized: true 165regBankSelected: true 166 167body: | 168 bb.0: 169 ; CHECK-LABEL: name: extract_sgpr_s64_from_s128 170 ; CHECK: [[DEF:%[0-9]+]]:sgpr_128 = IMPLICIT_DEF 171 ; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY [[DEF]].sub0_sub1 172 ; CHECK: [[COPY1:%[0-9]+]]:sreg_64 = COPY [[DEF]].sub2_sub3 173 ; CHECK: S_ENDPGM 0, implicit [[COPY]], implicit [[COPY1]] 174 %0:sgpr(s128) = G_IMPLICIT_DEF 175 %1:sgpr(s64) = G_EXTRACT %0, 0 176 %2:sgpr(s64) = G_EXTRACT %0, 64 177 S_ENDPGM 0, implicit %1, implicit %2 178 179... 180 181--- 182name: extract_sgpr_s96_from_s128 183legalized: true 184regBankSelected: true 185 186body: | 187 bb.0: 188 liveins: $sgpr0_sgpr1_sgpr2_sgpr3 189 ; CHECK-LABEL: name: extract_sgpr_s96_from_s128 190 ; CHECK: [[COPY:%[0-9]+]]:sgpr_128_with_sub1_sub2_sub3 = COPY $sgpr0_sgpr1_sgpr2_sgpr3 191 ; CHECK: [[COPY1:%[0-9]+]]:sgpr_128_with_sub0_sub1_sub2 = COPY [[COPY]] 192 ; CHECK: [[COPY2:%[0-9]+]]:sgpr_96 = COPY [[COPY1]].sub0_sub1_sub2 193 ; CHECK: [[COPY3:%[0-9]+]]:sgpr_96 = COPY [[COPY]].sub1_sub2_sub3 194 ; CHECK: S_ENDPGM 0, implicit [[COPY2]], implicit [[COPY3]] 195 %0:sgpr(s128) = COPY $sgpr0_sgpr1_sgpr2_sgpr3 196 %1:sgpr(s96) = G_EXTRACT %0, 0 197 %2:sgpr(s96) = G_EXTRACT %0, 32 198 S_ENDPGM 0, implicit %1, implicit %2 199 200... 201 202--- 203name: extract_sgpr_s32_from_v3s32 204legalized: true 205regBankSelected: true 206 207body: | 208 bb.0: 209 liveins: $sgpr0_sgpr1_sgpr2 210 ; CHECK-LABEL: name: extract_sgpr_s32_from_v3s32 211 ; CHECK: [[COPY:%[0-9]+]]:sgpr_96 = COPY $sgpr0_sgpr1_sgpr2 212 ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1 213 ; CHECK: [[COPY2:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub2 214 ; CHECK: S_ENDPGM 0, implicit [[COPY]], implicit [[COPY1]], implicit [[COPY2]] 215 %0:sgpr(<3 x s32>) = COPY $sgpr0_sgpr1_sgpr2 216 %1:sgpr(s32) = G_EXTRACT %0, 0 217 %2:sgpr(s32) = G_EXTRACT %0, 32 218 %3:sgpr(s32) = G_EXTRACT %0, 64 219 S_ENDPGM 0, implicit %0, implicit %2, implicit %3 220 221... 222 223--- 224name: extract_sgpr_v2s32_from_v3s32 225legalized: true 226regBankSelected: true 227 228body: | 229 bb.0: 230 liveins: $sgpr0_sgpr1_sgpr2 231 ; CHECK-LABEL: name: extract_sgpr_v2s32_from_v3s32 232 ; CHECK: [[COPY:%[0-9]+]]:sgpr_96_with_sub0_sub1 = COPY $sgpr0_sgpr1_sgpr2 233 ; CHECK: [[COPY1:%[0-9]+]]:sreg_64 = COPY [[COPY]].sub0_sub1 234 ; CHECK: S_ENDPGM 0, implicit [[COPY1]] 235 %0:sgpr(<3 x s32>) = COPY $sgpr0_sgpr1_sgpr2 236 %1:sgpr(<2 x s32>) = G_EXTRACT %0, 0 237 S_ENDPGM 0, implicit %1 238 239... 240 241--- 242name: extract_sgpr_v3s32_from_v4s32 243legalized: true 244regBankSelected: true 245 246body: | 247 bb.0: 248 liveins: $sgpr0_sgpr1_sgpr2_sgpr3 249 ; CHECK-LABEL: name: extract_sgpr_v3s32_from_v4s32 250 ; CHECK: [[COPY:%[0-9]+]]:sgpr_128_with_sub1_sub2_sub3 = COPY $sgpr0_sgpr1_sgpr2_sgpr3 251 ; CHECK: [[COPY1:%[0-9]+]]:sgpr_128_with_sub0_sub1_sub2 = COPY [[COPY]] 252 ; CHECK: [[COPY2:%[0-9]+]]:sgpr_96 = COPY [[COPY1]].sub0_sub1_sub2 253 ; CHECK: [[COPY3:%[0-9]+]]:sgpr_96 = COPY [[COPY]].sub1_sub2_sub3 254 ; CHECK: S_ENDPGM 0, implicit [[COPY2]], implicit [[COPY3]] 255 %0:sgpr(<4 x s32>) = COPY $sgpr0_sgpr1_sgpr2_sgpr3 256 %1:sgpr(<3 x s32>) = G_EXTRACT %0, 0 257 %2:sgpr(<3 x s32>) = G_EXTRACT %0, 32 258 S_ENDPGM 0, implicit %1, implicit %2 259 260... 261 262--- 263name: extract_sgpr_v2s16_from_v4s16_offset0 264legalized: true 265regBankSelected: true 266 267body: | 268 bb.0: 269 liveins: $sgpr0_sgpr1 270 ; CHECK-LABEL: name: extract_sgpr_v2s16_from_v4s16_offset0 271 ; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 272 ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0 273 ; CHECK: S_ENDPGM 0, implicit [[COPY1]] 274 %0:sgpr(<4 x s16>) = COPY $sgpr0_sgpr1 275 %1:sgpr(<2 x s16>) = G_EXTRACT %0, 0 276 S_ENDPGM 0, implicit %1 277 278... 279 280--- 281name: extract_sgpr_v2s16_from_v4s16_offset32 282legalized: true 283regBankSelected: true 284 285body: | 286 bb.0: 287 liveins: $sgpr0_sgpr1 288 ; CHECK-LABEL: name: extract_sgpr_v2s16_from_v4s16_offset32 289 ; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 290 ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1 291 ; CHECK: S_ENDPGM 0, implicit [[COPY1]] 292 %0:sgpr(<4 x s16>) = COPY $sgpr0_sgpr1 293 %1:sgpr(<2 x s16>) = G_EXTRACT %0, 32 294 S_ENDPGM 0, implicit %1 295 296... 297 298# FIXME: Probably should not be legal 299--- 300name: extract_sgpr_s16_from_v4s16_offset0 301legalized: true 302regBankSelected: true 303 304body: | 305 bb.0: 306 liveins: $sgpr0_sgpr1 307 ; CHECK-LABEL: name: extract_sgpr_s16_from_v4s16_offset0 308 ; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 309 ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub0 310 ; CHECK: S_ENDPGM 0, implicit [[COPY1]] 311 %0:sgpr(<4 x s16>) = COPY $sgpr0_sgpr1 312 %1:sgpr(s16) = G_EXTRACT %0, 0 313 S_ENDPGM 0, implicit %1 314 315... 316 317# FIXME: Probably should not be legal 318--- 319name: extract_sgpr_s16_from_v4s16_offset32 320legalized: true 321regBankSelected: true 322 323body: | 324 bb.0: 325 liveins: $sgpr0_sgpr1 326 ; CHECK-LABEL: name: extract_sgpr_s16_from_v4s16_offset32 327 ; CHECK: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr0_sgpr1 328 ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1 329 ; CHECK: S_ENDPGM 0, implicit [[COPY1]] 330 %0:sgpr(<4 x s16>) = COPY $sgpr0_sgpr1 331 %1:sgpr(s16) = G_EXTRACT %0, 32 332 S_ENDPGM 0, implicit %1 333 334... 335 336# FIXME: Probably should not be legal 337--- 338name: extract_sgpr_s16_from_v6s16_offset32 339legalized: true 340regBankSelected: true 341 342body: | 343 bb.0: 344 liveins: $sgpr0_sgpr1_sgpr2 345 ; CHECK-LABEL: name: extract_sgpr_s16_from_v6s16_offset32 346 ; CHECK: [[COPY:%[0-9]+]]:sgpr_96 = COPY $sgpr0_sgpr1_sgpr2 347 ; CHECK: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[COPY]].sub1 348 ; CHECK: S_ENDPGM 0, implicit [[COPY1]] 349 %0:sgpr(<6 x s16>) = COPY $sgpr0_sgpr1_sgpr2 350 %1:sgpr(s16) = G_EXTRACT %0, 32 351 S_ENDPGM 0, implicit %1 352 353... 354