1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -o - -mtriple=aarch64 -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s | FileCheck %s 3--- 4name: extract_from_build_vector 5alignment: 4 6tracksRegLiveness: true 7liveins: 8 - { reg: '$x0' } 9 - { reg: '$x1' } 10frameInfo: 11 maxAlignment: 1 12 maxCallFrameSize: 0 13machineFunctionInfo: {} 14body: | 15 bb.0: 16 liveins: $x0, $x1 17 18 ; CHECK-LABEL: name: extract_from_build_vector 19 ; CHECK: liveins: $x0, $x1 20 ; CHECK-NEXT: {{ $}} 21 ; CHECK-NEXT: %arg1:_(s64) = COPY $x0 22 ; CHECK-NEXT: $x0 = COPY %arg1(s64) 23 ; CHECK-NEXT: RET_ReallyLR implicit $x0 24 %arg1:_(s64) = COPY $x0 25 %arg2:_(s64) = COPY $x1 26 %zero:_(s64) = G_CONSTANT i64 0 27 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64) 28 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %zero(s64) 29 $x0 = COPY %extract(s64) 30 RET_ReallyLR implicit $x0 31 32... 33--- 34name: extract_from_trunc_build_vector 35alignment: 4 36tracksRegLiveness: true 37liveins: 38 - { reg: '$x0' } 39 - { reg: '$x1' } 40frameInfo: 41 maxAlignment: 1 42 maxCallFrameSize: 0 43machineFunctionInfo: {} 44body: | 45 bb.0: 46 liveins: $x0, $x1 47 48 ; CHECK-LABEL: name: extract_from_trunc_build_vector 49 ; CHECK: liveins: $x0, $x1 50 ; CHECK-NEXT: {{ $}} 51 ; CHECK-NEXT: %arg1:_(s64) = COPY $x0 52 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC %arg1(s64) 53 ; CHECK-NEXT: %zext:_(s64) = G_ZEXT [[TRUNC]](s32) 54 ; CHECK-NEXT: $x0 = COPY %zext(s64) 55 ; CHECK-NEXT: RET_ReallyLR implicit $x0 56 %arg1:_(s64) = COPY $x0 57 %arg2:_(s64) = COPY $x1 58 %zero:_(s64) = G_CONSTANT i64 0 59 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64) 60 %truncbv:_(<2 x s32>) = G_TRUNC %bv 61 %extract:_(s32) = G_EXTRACT_VECTOR_ELT %truncbv(<2 x s32>), %zero(s64) 62 %zext:_(s64) = G_ZEXT %extract 63 $x0 = COPY %zext(s64) 64 RET_ReallyLR implicit $x0 65 66... 67--- 68name: extract_from_build_vector_idx1 69alignment: 4 70tracksRegLiveness: true 71liveins: 72 - { reg: '$x0' } 73 - { reg: '$x1' } 74frameInfo: 75 maxAlignment: 1 76 maxCallFrameSize: 0 77machineFunctionInfo: {} 78body: | 79 bb.0: 80 liveins: $x0, $x1 81 82 ; CHECK-LABEL: name: extract_from_build_vector_idx1 83 ; CHECK: liveins: $x0, $x1 84 ; CHECK-NEXT: {{ $}} 85 ; CHECK-NEXT: %arg2:_(s64) = COPY $x1 86 ; CHECK-NEXT: $x0 = COPY %arg2(s64) 87 ; CHECK-NEXT: RET_ReallyLR implicit $x0 88 %arg1:_(s64) = COPY $x0 89 %arg2:_(s64) = COPY $x1 90 %one:_(s64) = G_CONSTANT i64 1 91 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64) 92 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %one(s64) 93 $x0 = COPY %extract(s64) 94 RET_ReallyLR implicit $x0 95 96... 97--- 98name: extract_from_build_vector_idx_invalid 99alignment: 4 100tracksRegLiveness: true 101liveins: 102 - { reg: '$x0' } 103 - { reg: '$x1' } 104frameInfo: 105 maxAlignment: 1 106 maxCallFrameSize: 0 107machineFunctionInfo: {} 108body: | 109 bb.0: 110 liveins: $x0, $x1 111 112 ; CHECK-LABEL: name: extract_from_build_vector_idx_invalid 113 ; CHECK: liveins: $x0, $x1 114 ; CHECK-NEXT: {{ $}} 115 ; CHECK-NEXT: %extract:_(s64) = G_IMPLICIT_DEF 116 ; CHECK-NEXT: $x0 = COPY %extract(s64) 117 ; CHECK-NEXT: RET_ReallyLR implicit $x0 118 %arg1:_(s64) = COPY $x0 119 %arg2:_(s64) = COPY $x1 120 %idx:_(s64) = G_CONSTANT i64 4 121 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64) 122 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %idx(s64) 123 $x0 = COPY %extract(s64) 124 RET_ReallyLR implicit $x0 125 126... 127--- 128name: extract_from_build_vector_trunc 129alignment: 4 130tracksRegLiveness: true 131liveins: 132 - { reg: '$x0' } 133 - { reg: '$x1' } 134frameInfo: 135 maxAlignment: 1 136 maxCallFrameSize: 0 137machineFunctionInfo: {} 138body: | 139 bb.0: 140 liveins: $x0, $x1 141 142 ; CHECK-LABEL: name: extract_from_build_vector_trunc 143 ; CHECK: liveins: $x0, $x1 144 ; CHECK-NEXT: {{ $}} 145 ; CHECK-NEXT: %arg1:_(s64) = COPY $x0 146 ; CHECK-NEXT: %extract:_(s32) = G_TRUNC %arg1(s64) 147 ; CHECK-NEXT: $w0 = COPY %extract(s32) 148 ; CHECK-NEXT: RET_ReallyLR implicit $w0 149 %arg1:_(s64) = COPY $x0 150 %arg2:_(s64) = COPY $x1 151 %zero:_(s64) = G_CONSTANT i64 0 152 %bv:_(<2 x s32>) = G_BUILD_VECTOR_TRUNC %arg1(s64), %arg2(s64) 153 %extract:_(s32) = G_EXTRACT_VECTOR_ELT %bv(<2 x s32>), %zero(s64) 154 $w0 = COPY %extract(s32) 155 RET_ReallyLR implicit $w0 156 157... 158--- 159name: extract_from_build_vector_multiple_uses 160alignment: 4 161tracksRegLiveness: true 162liveins: 163 - { reg: '$x0' } 164 - { reg: '$x1' } 165frameInfo: 166 maxAlignment: 1 167 maxCallFrameSize: 0 168machineFunctionInfo: {} 169body: | 170 bb.0: 171 liveins: $x0, $x1 172 173 ; CHECK-LABEL: name: extract_from_build_vector_multiple_uses 174 ; CHECK: liveins: $x0, $x1 175 ; CHECK-NEXT: {{ $}} 176 ; CHECK-NEXT: %arg1:_(s64) = COPY $x0 177 ; CHECK-NEXT: %arg2:_(s64) = COPY $x1 178 ; CHECK-NEXT: %zero:_(s64) = G_CONSTANT i64 0 179 ; CHECK-NEXT: %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64) 180 ; CHECK-NEXT: %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %zero(s64) 181 ; CHECK-NEXT: $x0 = COPY %extract(s64) 182 ; CHECK-NEXT: $q0 = COPY %bv(<2 x s64>) 183 ; CHECK-NEXT: RET_ReallyLR implicit $x0 184 %arg1:_(s64) = COPY $x0 185 %arg2:_(s64) = COPY $x1 186 %zero:_(s64) = G_CONSTANT i64 0 187 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64) 188 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %zero(s64) 189 $x0 = COPY %extract(s64) 190 $q0 = COPY %bv(<2 x s64>) 191 RET_ReallyLR implicit $x0 192 193... 194--- 195# This test checks that this combine runs after the insertvec->build_vector 196name: extract_from_insert 197tracksRegLiveness: true 198liveins: 199 - { reg: '$x0' } 200 - { reg: '$x1' } 201frameInfo: 202 maxAlignment: 1 203body: | 204 bb.1: 205 liveins: $x0, $x1 206 ; CHECK-LABEL: name: extract_from_insert 207 ; CHECK: liveins: $x0, $x1 208 ; CHECK-NEXT: {{ $}} 209 ; CHECK-NEXT: %arg1:_(s64) = COPY $x0 210 ; CHECK-NEXT: $x0 = COPY %arg1(s64) 211 ; CHECK-NEXT: RET_ReallyLR implicit $x0 212 %arg1:_(s64) = COPY $x0 213 %arg2:_(s64) = COPY $x1 214 %undef:_(<2 x s64>) = G_IMPLICIT_DEF 215 %zero:_(s64) = G_CONSTANT i64 0 216 %one:_(s64) = G_CONSTANT i64 1 217 %ins1:_(<2 x s64>) = G_INSERT_VECTOR_ELT %undef, %arg1(s64), %zero(s64) 218 %ins2:_(<2 x s64>) = G_INSERT_VECTOR_ELT %ins1, %arg2(s64), %one(s64) 219 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %ins2(<2 x s64>), %zero(s64) 220 $x0 = COPY %extract(s64) 221 RET_ReallyLR implicit $x0 222 223... 224--- 225# This test checks that this combine runs after the insertvec->build_vector 226name: extract_from_insert2 227tracksRegLiveness: true 228liveins: 229 - { reg: '$x0' } 230 - { reg: '$x1' } 231frameInfo: 232 maxAlignment: 1 233body: | 234 bb.1: 235 liveins: $q0, $x0, $x1 236 ; CHECK-LABEL: name: extract_from_insert2 237 ; CHECK: liveins: $q0, $x0, $x1 238 ; CHECK-NEXT: {{ $}} 239 ; CHECK-NEXT: %arg1:_(s64) = COPY $x0 240 ; CHECK-NEXT: %arg2:_(s64) = COPY $x1 241 ; CHECK-NEXT: %ins2:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64) 242 ; CHECK-NEXT: $q0 = COPY %ins2(<2 x s64>) 243 ; CHECK-NEXT: RET_ReallyLR implicit $q0 244 %arg0:_(<2 x s64>) = COPY $q0 245 %arg1:_(s64) = COPY $x0 246 %arg2:_(s64) = COPY $x1 247 %zero:_(s64) = G_CONSTANT i64 0 248 %one:_(s64) = G_CONSTANT i64 1 249 %ins1:_(<2 x s64>) = G_INSERT_VECTOR_ELT %arg0, %arg1(s64), %zero(s64) 250 %ins2:_(<2 x s64>) = G_INSERT_VECTOR_ELT %ins1, %arg2(s64), %one(s64) 251 $q0 = COPY %ins2(<2 x s64>) 252 RET_ReallyLR implicit $q0 253 254... 255--- 256name: extract_from_idx_negative 257alignment: 4 258liveins: 259 - { reg: '$x0' } 260 - { reg: '$x1' } 261frameInfo: 262 maxAlignment: 1 263body: | 264 bb.1: 265 liveins: $x0, $x1 266 ; CHECK-LABEL: name: extract_from_idx_negative 267 ; CHECK: liveins: $x0, $x1 268 ; CHECK-NEXT: {{ $}} 269 ; CHECK-NEXT: %extract:_(s64) = G_IMPLICIT_DEF 270 ; CHECK-NEXT: $x0 = COPY %extract(s64) 271 ; CHECK-NEXT: RET_ReallyLR implicit $x0 272 %vec:_(<2 x s64>) = COPY $q0 273 %idx:_(s64) = G_CONSTANT i64 -2 274 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %vec(<2 x s64>), %idx(s64) 275 $x0 = COPY %extract(s64) 276 RET_ReallyLR implicit $x0 277 278... 279--- 280name: extract_from_vector_undef 281alignment: 4 282liveins: 283 - { reg: '$x0' } 284 - { reg: '$x1' } 285frameInfo: 286 maxAlignment: 1 287body: | 288 bb.1: 289 liveins: $x0, $x1 290 ; CHECK-LABEL: name: extract_from_vector_undef 291 ; CHECK: liveins: $x0, $x1 292 ; CHECK-NEXT: {{ $}} 293 ; CHECK-NEXT: %extract:_(s64) = G_IMPLICIT_DEF 294 ; CHECK-NEXT: $x0 = COPY %extract(s64) 295 ; CHECK-NEXT: RET_ReallyLR implicit $x0 296 %vec:_(<2 x s64>) = G_IMPLICIT_DEF 297 %idx:_(s64) = G_CONSTANT i64 -2 298 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %vec(<2 x s64>), %idx(s64) 299 $x0 = COPY %extract(s64) 300 RET_ReallyLR implicit $x0 301 302... 303--- 304name: extract_from_index_undef 305alignment: 4 306liveins: 307 - { reg: '$x0' } 308 - { reg: '$x1' } 309frameInfo: 310 maxAlignment: 1 311body: | 312 bb.1: 313 ; CHECK-LABEL: name: extract_from_index_undef 314 ; CHECK: %extract:_(s64) = G_IMPLICIT_DEF 315 ; CHECK-NEXT: $x0 = COPY %extract(s64) 316 ; CHECK-NEXT: RET_ReallyLR implicit $x0 317 %vec:_(<2 x s64>) = COPY $q0 318 %idx:_(s64) = G_IMPLICIT_DEF 319 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %vec(<2 x s64>), %idx(s64) 320 $x0 = COPY %extract(s64) 321 RET_ReallyLR implicit $x0 322 323... 324--- 325name: extract_from_index_too_large 326alignment: 4 327liveins: 328 - { reg: '$x0' } 329 - { reg: '$x1' } 330frameInfo: 331 maxAlignment: 1 332body: | 333 bb.1: 334 liveins: $x0, $x1 335 ; CHECK-LABEL: name: extract_from_index_too_large 336 ; CHECK: liveins: $x0, $x1 337 ; CHECK-NEXT: {{ $}} 338 ; CHECK-NEXT: %extract:_(s64) = G_IMPLICIT_DEF 339 ; CHECK-NEXT: $x0 = COPY %extract(s64) 340 ; CHECK-NEXT: RET_ReallyLR implicit $x0 341 %vec:_(<2 x s64>) = COPY $q0 342 %idx:_(s64) = G_CONSTANT i64 3000 343 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %vec(<2 x s64>), %idx(s64) 344 $x0 = COPY %extract(s64) 345 RET_ReallyLR implicit $x0 346 347... 348--- 349name: extract_with_freeze 350alignment: 4 351liveins: 352 - { reg: '$x0' } 353 - { reg: '$x1' } 354frameInfo: 355 maxAlignment: 1 356body: | 357 bb.1: 358 liveins: $x0, $x1 359 ; CHECK-LABEL: name: extract_with_freeze 360 ; CHECK: liveins: $x0, $x1 361 ; CHECK-NEXT: {{ $}} 362 ; CHECK-NEXT: %vec:_(<2 x s64>) = COPY $q0 363 ; CHECK-NEXT: %idx:_(s64) = COPY $x1 364 ; CHECK-NEXT: %fvec:_(<2 x s64>) = G_FREEZE %vec 365 ; CHECK-NEXT: %extract:_(s64) = G_EXTRACT_VECTOR_ELT %fvec(<2 x s64>), %idx(s64) 366 ; CHECK-NEXT: $x0 = COPY %extract(s64) 367 ; CHECK-NEXT: RET_ReallyLR implicit $x0 368 %vec:_(<2 x s64>) = COPY $q0 369 %idx:_(s64) = COPY $x1 370 %fvec:_(<2 x s64>) = G_FREEZE %vec 371 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %fvec(<2 x s64>), %idx(s64) 372 $x0 = COPY %extract(s64) 373 RET_ReallyLR implicit $x0 374 375... 376--- 377name: extract_from_insert_symmetry 378alignment: 4 379liveins: 380 - { reg: '$x0' } 381 - { reg: '$x1' } 382frameInfo: 383 maxAlignment: 1 384body: | 385 bb.1: 386 liveins: $x0, $x1 387 ; CHECK-LABEL: name: extract_from_insert_symmetry 388 ; CHECK: liveins: $x0, $x1 389 ; CHECK-NEXT: {{ $}} 390 ; CHECK-NEXT: %element:_(s64) = COPY $x1 391 ; CHECK-NEXT: $x0 = COPY %element(s64) 392 ; CHECK-NEXT: RET_ReallyLR implicit $x0 393 %vec:_(<2 x s64>) = COPY $q0 394 %idx:_(s64) = COPY $x1 395 %element:_(s64) = COPY $x1 396 %invec:_(<2 x s64>) = G_INSERT_VECTOR_ELT %vec(<2 x s64>), %element(s64), %idx(s64) 397 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %invec(<2 x s64>), %idx(s64) 398 $x0 = COPY %extract(s64) 399 RET_ReallyLR implicit $x0 400 401... 402--- 403name: extract_from_insert_with_different_consts 404alignment: 4 405liveins: 406 - { reg: '$x0' } 407 - { reg: '$x1' } 408frameInfo: 409 maxAlignment: 1 410body: | 411 bb.1: 412 liveins: $x0, $x1 413 ; CHECK-LABEL: name: extract_from_insert_with_different_consts 414 ; CHECK: liveins: $x0, $x1 415 ; CHECK-NEXT: {{ $}} 416 ; CHECK-NEXT: %vec:_(<2 x s64>) = COPY $q0 417 ; CHECK-NEXT: %idx2:_(s64) = G_CONSTANT i64 1 418 ; CHECK-NEXT: %extract:_(s64) = G_EXTRACT_VECTOR_ELT %vec(<2 x s64>), %idx2(s64) 419 ; CHECK-NEXT: $x0 = COPY %extract(s64) 420 ; CHECK-NEXT: RET_ReallyLR implicit $x0 421 %vec:_(<2 x s64>) = COPY $q0 422 %idx:_(s64) = G_CONSTANT i64 0 423 %idx2:_(s64) = G_CONSTANT i64 1 424 %element:_(s64) = COPY $x1 425 %invec:_(<2 x s64>) = G_INSERT_VECTOR_ELT %vec(<2 x s64>), %element(s64), %idx(s64) 426 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %invec(<2 x s64>), %idx2(s64) 427 $x0 = COPY %extract(s64) 428 RET_ReallyLR implicit $x0 429 430... 431--- 432name: extract_from_build_vector_non_const 433alignment: 4 434liveins: 435 - { reg: '$x0' } 436 - { reg: '$x1' } 437frameInfo: 438 maxAlignment: 1 439body: | 440 bb.1: 441 liveins: $x0, $x1 442 ; CHECK-LABEL: name: extract_from_build_vector_non_const 443 ; CHECK: liveins: $x0, $x1 444 ; CHECK-NEXT: {{ $}} 445 ; CHECK-NEXT: %idx:_(s64) = COPY $x0 446 ; CHECK-NEXT: %arg1:_(s64) = COPY $x0 447 ; CHECK-NEXT: %arg2:_(s64) = COPY $x1 448 ; CHECK-NEXT: %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64) 449 ; CHECK-NEXT: %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %idx(s64) 450 ; CHECK-NEXT: $x0 = COPY %extract(s64) 451 ; CHECK-NEXT: RET_ReallyLR implicit $x0 452 %vec:_(<2 x s64>) = COPY $q0 453 %idx:_(s64) = COPY $x0 454 %arg1:_(s64) = COPY $x0 455 %arg2:_(s64) = COPY $x1 456 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64) 457 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %idx(s64) 458 $x0 = COPY %extract(s64) 459 RET_ReallyLR implicit $x0 460 461... 462--- 463name: extract_from_build_vector_const 464alignment: 4 465liveins: 466 - { reg: '$x0' } 467 - { reg: '$x1' } 468frameInfo: 469 maxAlignment: 1 470body: | 471 bb.1: 472 liveins: $x0, $x1 473 ; CHECK-LABEL: name: extract_from_build_vector_const 474 ; CHECK: liveins: $x0, $x1 475 ; CHECK-NEXT: {{ $}} 476 ; CHECK-NEXT: %arg1:_(s64) = COPY $x0 477 ; CHECK-NEXT: $x0 = COPY %arg1(s64) 478 ; CHECK-NEXT: RET_ReallyLR implicit $x0 479 %vec:_(<2 x s64>) = COPY $q0 480 %idx:_(s64) = G_CONSTANT i64 0 481 %arg1:_(s64) = COPY $x0 482 %arg2:_(s64) = COPY $x1 483 %bv:_(<2 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64) 484 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %idx(s64) 485 $x0 = COPY %extract(s64) 486 RET_ReallyLR implicit $x0 487 488... 489--- 490name: extract_from_build_vector_trunc_const2 491alignment: 4 492liveins: 493 - { reg: '$x0' } 494 - { reg: '$x1' } 495frameInfo: 496 maxAlignment: 1 497body: | 498 bb.1: 499 liveins: $x0, $x1 500 ; CHECK-LABEL: name: extract_from_build_vector_trunc_const2 501 ; CHECK: liveins: $x0, $x1 502 ; CHECK-NEXT: {{ $}} 503 ; CHECK-NEXT: %arg1:_(s64) = COPY $x0 504 ; CHECK-NEXT: %extract:_(s32) = G_TRUNC %arg1(s64) 505 ; CHECK-NEXT: $w0 = COPY %extract(s32) 506 ; CHECK-NEXT: RET_ReallyLR implicit $x0 507 %vec:_(<2 x s64>) = COPY $q0 508 %arg1:_(s64) = COPY $x0 509 %arg2:_(s64) = COPY $x1 510 %arg3:_(s64) = COPY $x0 511 %arg4:_(s64) = COPY $x1 512 %idx:_(s64) = G_CONSTANT i64 0 513 %bv:_(<4 x s32>) = G_BUILD_VECTOR_TRUNC %arg1(s64), %arg2(s64), %arg3(s64), %arg4(s64) 514 %extract:_(s32) = G_EXTRACT_VECTOR_ELT %bv(<4 x s32>), %idx(s64) 515 $w0 = COPY %extract(s32) 516 RET_ReallyLR implicit $x0 517... 518--- 519name: extract_from_build_vector_trunc2 520alignment: 4 521liveins: 522 - { reg: '$x0' } 523 - { reg: '$x1' } 524frameInfo: 525 maxAlignment: 1 526body: | 527 bb.1: 528 liveins: $x0, $x1 529 ; CHECK-LABEL: name: extract_from_build_vector_trunc2 530 ; CHECK: liveins: $x0, $x1 531 ; CHECK-NEXT: {{ $}} 532 ; CHECK-NEXT: %arg1:_(s64) = COPY $x0 533 ; CHECK-NEXT: %arg2:_(s64) = COPY $x1 534 ; CHECK-NEXT: %idx:_(s64) = COPY $x0 535 ; CHECK-NEXT: %bv:_(<2 x s32>) = G_BUILD_VECTOR_TRUNC %arg1(s64), %arg2(s64) 536 ; CHECK-NEXT: %extract:_(s32) = G_EXTRACT_VECTOR_ELT %bv(<2 x s32>), %idx(s64) 537 ; CHECK-NEXT: $w0 = COPY %extract(s32) 538 ; CHECK-NEXT: RET_ReallyLR implicit $x0 539 %arg1:_(s64) = COPY $x0 540 %arg2:_(s64) = COPY $x1 541 %idx:_(s64) = COPY $x0 542 %bv:_(<2 x s32>) = G_BUILD_VECTOR_TRUNC %arg1(s64), %arg2(s64) 543 %extract:_(s32) = G_EXTRACT_VECTOR_ELT %bv(<2 x s32>), %idx(s64) 544 $w0 = COPY %extract(s32) 545 RET_ReallyLR implicit $x0 546... 547--- 548name: extract_from_build_vector_trunc_const3 549alignment: 4 550liveins: 551 - { reg: '$x0' } 552 - { reg: '$x1' } 553frameInfo: 554 maxAlignment: 1 555body: | 556 bb.1: 557 liveins: $x0, $x1 558 ; CHECK-LABEL: name: extract_from_build_vector_trunc_const3 559 ; CHECK: liveins: $x0, $x1 560 ; CHECK-NEXT: {{ $}} 561 ; CHECK-NEXT: %arg1:_(s128) = COPY $q0 562 ; CHECK-NEXT: %extract:_(s64) = G_TRUNC %arg1(s128) 563 ; CHECK-NEXT: $x0 = COPY %extract(s64) 564 ; CHECK-NEXT: RET_ReallyLR implicit $x0 565 %arg1:_(s128) = COPY $q0 566 %arg2:_(s128) = COPY $q1 567 %idx:_(s64) = G_CONSTANT i64 0 568 %bv:_(<2 x s64>) = G_BUILD_VECTOR_TRUNC %arg1(s128), %arg2(s128) 569 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<2 x s64>), %idx(s64) 570 $x0 = COPY %extract(s64) 571 RET_ReallyLR implicit $x0 572... 573--- 574name: extract_from_build_vector_shuffle_vector_undef 575body: | 576 bb.1: 577 liveins: $x0, $x1 578 ; CHECK-LABEL: name: extract_from_build_vector_shuffle_vector_undef 579 ; CHECK: liveins: $x0, $x1 580 ; CHECK-NEXT: {{ $}} 581 ; CHECK-NEXT: %extract:_(s32) = G_IMPLICIT_DEF 582 ; CHECK-NEXT: $w0 = COPY %extract(s32) 583 ; CHECK-NEXT: RET_ReallyLR implicit $x0 584 %arg1:_(<4 x s32>) = COPY $q0 585 %arg2:_(<4 x s32>) = COPY $q1 586 %idx:_(s64) = G_CONSTANT i64 0 587 %sv:_(<4 x s32>) = G_SHUFFLE_VECTOR %arg1(<4 x s32>), %arg2(<4 x s32>), shufflemask(-1, 0, 0, 0) 588 %extract:_(s32) = G_EXTRACT_VECTOR_ELT %sv(<4 x s32>), %idx(s64) 589 $w0 = COPY %extract(s32) 590 RET_ReallyLR implicit $x0 591... 592--- 593name: extract_from_build_vector_shuffle_vector_opaque 594body: | 595 bb.1: 596 liveins: $x0, $x1 597 ; CHECK-LABEL: name: extract_from_build_vector_shuffle_vector_opaque 598 ; CHECK: liveins: $x0, $x1 599 ; CHECK-NEXT: {{ $}} 600 ; CHECK-NEXT: %arg1:_(<4 x s32>) = COPY $q0 601 ; CHECK-NEXT: %idx:_(s64) = COPY $x1 602 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(<4 x s32>) = G_IMPLICIT_DEF 603 ; CHECK-NEXT: %sv:_(<4 x s32>) = G_SHUFFLE_VECTOR %arg1(<4 x s32>), [[DEF]], shufflemask(undef, 0, 0, 0) 604 ; CHECK-NEXT: %extract:_(s32) = G_EXTRACT_VECTOR_ELT %sv(<4 x s32>), %idx(s64) 605 ; CHECK-NEXT: $w0 = COPY %extract(s32) 606 ; CHECK-NEXT: RET_ReallyLR implicit $x0 607 %arg1:_(<4 x s32>) = COPY $q0 608 %arg2:_(<4 x s32>) = COPY $q1 609 %idx:_(s64) = COPY $x1 610 %sv:_(<4 x s32>) = G_SHUFFLE_VECTOR %arg1(<4 x s32>), %arg2(<4 x s32>), shufflemask(-1, 0, 0, 0) 611 %extract:_(s32) = G_EXTRACT_VECTOR_ELT %sv(<4 x s32>), %idx(s64) 612 $w0 = COPY %extract(s32) 613 RET_ReallyLR implicit $x0 614... 615--- 616name: extract_from_build_vector_shuffle_vector_const 617body: | 618 bb.1: 619 liveins: $x0, $x1 620 ; CHECK-LABEL: name: extract_from_build_vector_shuffle_vector_const 621 ; CHECK: liveins: $x0, $x1 622 ; CHECK-NEXT: {{ $}} 623 ; CHECK-NEXT: %arg1:_(<4 x s32>) = COPY $q0 624 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 3 625 ; CHECK-NEXT: %extract:_(s32) = G_EXTRACT_VECTOR_ELT %arg1(<4 x s32>), [[C]](s64) 626 ; CHECK-NEXT: $w0 = COPY %extract(s32) 627 ; CHECK-NEXT: RET_ReallyLR implicit $x0 628 %arg1:_(<4 x s32>) = COPY $q0 629 %arg2:_(<4 x s32>) = COPY $q1 630 %idx:_(s64) = G_CONSTANT i64 0 631 %sv:_(<4 x s32>) = G_SHUFFLE_VECTOR %arg1(<4 x s32>), %arg2(<4 x s32>), shufflemask(3, 0, 0, 0) 632 %extract:_(s32) = G_EXTRACT_VECTOR_ELT %sv(<4 x s32>), %idx(s64) 633 $w0 = COPY %extract(s32) 634 RET_ReallyLR implicit $x0 635... 636--- 637name: extract_from_build_vector_const_huge 638alignment: 4 639liveins: 640 - { reg: '$x0' } 641 - { reg: '$x1' } 642frameInfo: 643 maxAlignment: 1 644body: | 645 bb.1: 646 liveins: $x0, $x1 647 ; CHECK-LABEL: name: extract_from_build_vector_const_huge 648 ; CHECK: liveins: $x0, $x1 649 ; CHECK-NEXT: {{ $}} 650 ; CHECK-NEXT: %arg1:_(s64) = COPY $x0 651 ; CHECK-NEXT: $x0 = COPY %arg1(s64) 652 ; CHECK-NEXT: RET_ReallyLR implicit $x0 653 %vec:_(<2 x s64>) = COPY $q0 654 %idx:_(s64) = G_CONSTANT i64 0 655 %arg1:_(s64) = COPY $x0 656 %arg2:_(s64) = COPY $x1 657 %bv:_(<18 x s64>) = G_BUILD_VECTOR %arg1(s64), %arg2(s64), %arg1(s64), %arg2(s64), %arg1(s64), %arg2(s64), %arg1(s64), %arg2(s64), %arg1(s64), %arg2(s64), %arg1(s64), %arg2(s64), %arg1(s64), %arg2(s64), %arg1(s64), %arg2(s64), %arg1(s64), %arg2(s64) 658 %extract:_(s64) = G_EXTRACT_VECTOR_ELT %bv(<18 x s64>), %idx(s64) 659 $x0 = COPY %extract(s64) 660 RET_ReallyLR implicit $x0 661 662... 663--- 664