legalize-build-vector.s16.mir 34.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=hawaii -O0 -run-pass=legalizer %s -o - | FileCheck -check-prefix=GFX78 %s
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -O0 -run-pass=legalizer %s -o - | FileCheck -check-prefix=GFX78 %s
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -O0 -run-pass=legalizer %s -o - | FileCheck -check-prefix=GFX9 %s

---
name: build_vector_v2s16
body: |
  bb.0:
    liveins: $vgpr0, $vgpr1

    ; GFX78-LABEL: name: build_vector_v2s16
    ; GFX78: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX78: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX78: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; GFX78: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX78: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
    ; GFX78: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX78: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
    ; GFX78: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; GFX78: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C1]](s32)
    ; GFX78: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[SHL]]
    ; GFX78: [[BITCAST:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
    ; GFX78: S_NOP 0, implicit [[BITCAST]](<2 x s16>)
    ; GFX9-LABEL: name: build_vector_v2s16
    ; GFX9: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX9: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX9: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY2]](s32), [[COPY3]](s32)
    ; GFX9: S_NOP 0, implicit [[BUILD_VECTOR_TRUNC]](<2 x s16>)
    %0:_(s32) = COPY $vgpr0
    %1:_(s32) = COPY $vgpr1
    %2:_(s16) = G_TRUNC %0
    %3:_(s16) = G_TRUNC %1
    %4:_(<2 x s16>) = G_BUILD_VECTOR %2, %3
    S_NOP 0, implicit %4
...

---
name: build_vector_v3s16
body: |
  bb.0:
    liveins: $vgpr0, $vgpr1, $vgpr2

    ; GFX78-LABEL: name: build_vector_v3s16
    ; GFX78: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX78: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX78: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; GFX78: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
    ; GFX78: [[DEF1:%[0-9]+]]:_(<2 x s16>) = G_IMPLICIT_DEF
    ; GFX78: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; GFX78: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX78: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
    ; GFX78: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX78: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C]]
    ; GFX78: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; GFX78: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C1]](s32)
    ; GFX78: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[SHL]]
    ; GFX78: [[BITCAST:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
    ; GFX78: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX78: [[AND2:%[0-9]+]]:_(s32) = G_AND [[COPY5]], [[C]]
    ; GFX78: [[COPY6:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX78: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY6]], [[C]]
    ; GFX78: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[AND3]], [[C1]](s32)
    ; GFX78: [[OR1:%[0-9]+]]:_(s32) = G_OR [[AND2]], [[SHL1]]
    ; GFX78: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR1]](s32)
    ; GFX78: [[COPY7:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX78: [[AND4:%[0-9]+]]:_(s32) = G_AND [[COPY7]], [[C]]
    ; GFX78: [[COPY8:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX78: [[AND5:%[0-9]+]]:_(s32) = G_AND [[COPY8]], [[C]]
    ; GFX78: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[AND5]], [[C1]](s32)
    ; GFX78: [[OR2:%[0-9]+]]:_(s32) = G_OR [[AND4]], [[SHL2]]
    ; GFX78: [[BITCAST2:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR2]](s32)
    ; GFX78: [[CONCAT_VECTORS:%[0-9]+]]:_(<6 x s16>) = G_CONCAT_VECTORS [[BITCAST]](<2 x s16>), [[BITCAST1]](<2 x s16>), [[BITCAST2]](<2 x s16>)
    ; GFX78: S_NOP 0, implicit [[CONCAT_VECTORS]](<6 x s16>)
    ; GFX9-LABEL: name: build_vector_v3s16
    ; GFX9: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX9: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; GFX9: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
    ; GFX9: [[DEF1:%[0-9]+]]:_(<2 x s16>) = G_IMPLICIT_DEF
    ; GFX9: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX9: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY3]](s32), [[COPY4]](s32)
    ; GFX9: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX9: [[COPY6:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC1:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY5]](s32), [[COPY6]](s32)
    ; GFX9: [[COPY7:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX9: [[COPY8:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC2:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY7]](s32), [[COPY8]](s32)
    ; GFX9: [[CONCAT_VECTORS:%[0-9]+]]:_(<6 x s16>) = G_CONCAT_VECTORS [[BUILD_VECTOR_TRUNC]](<2 x s16>), [[BUILD_VECTOR_TRUNC1]](<2 x s16>), [[BUILD_VECTOR_TRUNC2]](<2 x s16>)
    ; GFX9: S_NOP 0, implicit [[CONCAT_VECTORS]](<6 x s16>)
    %0:_(s32) = COPY $vgpr0
    %1:_(s32) = COPY $vgpr1
    %2:_(s32) = COPY $vgpr2
    %3:_(s16) = G_TRUNC %0
    %4:_(s16) = G_TRUNC %1
    %5:_(s16) = G_TRUNC %2
    %6:_(<3 x s16>) = G_BUILD_VECTOR %3, %4, %5
    %7:_(<6 x s16>) = G_CONCAT_VECTORS %6, %6
    S_NOP 0, implicit %7
...

---
name: build_vector_v4s16
body: |
  bb.0:
    liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3

    ; GFX78-LABEL: name: build_vector_v4s16
    ; GFX78: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX78: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX78: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; GFX78: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
    ; GFX78: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; GFX78: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX78: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C]]
    ; GFX78: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX78: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY5]], [[C]]
    ; GFX78: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; GFX78: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C1]](s32)
    ; GFX78: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[SHL]]
    ; GFX78: [[BITCAST:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
    ; GFX78: [[COPY6:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX78: [[AND2:%[0-9]+]]:_(s32) = G_AND [[COPY6]], [[C]]
    ; GFX78: [[COPY7:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX78: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY7]], [[C]]
    ; GFX78: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[AND3]], [[C1]](s32)
    ; GFX78: [[OR1:%[0-9]+]]:_(s32) = G_OR [[AND2]], [[SHL1]]
    ; GFX78: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR1]](s32)
    ; GFX78: [[CONCAT_VECTORS:%[0-9]+]]:_(<4 x s16>) = G_CONCAT_VECTORS [[BITCAST]](<2 x s16>), [[BITCAST1]](<2 x s16>)
    ; GFX78: S_NOP 0, implicit [[CONCAT_VECTORS]](<4 x s16>)
    ; GFX9-LABEL: name: build_vector_v4s16
    ; GFX9: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX9: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; GFX9: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
    ; GFX9: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX9: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY4]](s32), [[COPY5]](s32)
    ; GFX9: [[COPY6:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX9: [[COPY7:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC1:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY6]](s32), [[COPY7]](s32)
    ; GFX9: [[CONCAT_VECTORS:%[0-9]+]]:_(<4 x s16>) = G_CONCAT_VECTORS [[BUILD_VECTOR_TRUNC]](<2 x s16>), [[BUILD_VECTOR_TRUNC1]](<2 x s16>)
    ; GFX9: S_NOP 0, implicit [[CONCAT_VECTORS]](<4 x s16>)
    %0:_(s32) = COPY $vgpr0
    %1:_(s32) = COPY $vgpr1
    %2:_(s32) = COPY $vgpr2
    %3:_(s32) = COPY $vgpr3
    %4:_(s16) = G_TRUNC %0
    %5:_(s16) = G_TRUNC %1
    %6:_(s16) = G_TRUNC %2
    %7:_(s16) = G_TRUNC %3
    %8:_(<4 x s16>) = G_BUILD_VECTOR %4, %5, %6, %7
    S_NOP 0, implicit %8
...

---
name: build_vector_v5s16
body: |
  bb.0:
    liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4

    ; GFX78-LABEL: name: build_vector_v5s16
    ; GFX78: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX78: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX78: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; GFX78: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
    ; GFX78: [[COPY4:%[0-9]+]]:_(s32) = COPY $vgpr4
    ; GFX78: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
    ; GFX78: [[DEF1:%[0-9]+]]:_(<2 x s16>) = G_IMPLICIT_DEF
    ; GFX78: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; GFX78: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX78: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY5]], [[C]]
    ; GFX78: [[COPY6:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX78: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY6]], [[C]]
    ; GFX78: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; GFX78: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C1]](s32)
    ; GFX78: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[SHL]]
    ; GFX78: [[BITCAST:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
    ; GFX78: [[COPY7:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX78: [[AND2:%[0-9]+]]:_(s32) = G_AND [[COPY7]], [[C]]
    ; GFX78: [[COPY8:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX78: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY8]], [[C]]
    ; GFX78: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[AND3]], [[C1]](s32)
    ; GFX78: [[OR1:%[0-9]+]]:_(s32) = G_OR [[AND2]], [[SHL1]]
    ; GFX78: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR1]](s32)
    ; GFX78: [[COPY9:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
    ; GFX78: [[AND4:%[0-9]+]]:_(s32) = G_AND [[COPY9]], [[C]]
    ; GFX78: [[COPY10:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX78: [[AND5:%[0-9]+]]:_(s32) = G_AND [[COPY10]], [[C]]
    ; GFX78: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[AND5]], [[C1]](s32)
    ; GFX78: [[OR2:%[0-9]+]]:_(s32) = G_OR [[AND4]], [[SHL2]]
    ; GFX78: [[BITCAST2:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR2]](s32)
    ; GFX78: [[COPY11:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX78: [[AND6:%[0-9]+]]:_(s32) = G_AND [[COPY11]], [[C]]
    ; GFX78: [[COPY12:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX78: [[AND7:%[0-9]+]]:_(s32) = G_AND [[COPY12]], [[C]]
    ; GFX78: [[SHL3:%[0-9]+]]:_(s32) = G_SHL [[AND7]], [[C1]](s32)
    ; GFX78: [[OR3:%[0-9]+]]:_(s32) = G_OR [[AND6]], [[SHL3]]
    ; GFX78: [[BITCAST3:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR3]](s32)
    ; GFX78: [[COPY13:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX78: [[AND8:%[0-9]+]]:_(s32) = G_AND [[COPY13]], [[C]]
    ; GFX78: [[COPY14:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
    ; GFX78: [[AND9:%[0-9]+]]:_(s32) = G_AND [[COPY14]], [[C]]
    ; GFX78: [[SHL4:%[0-9]+]]:_(s32) = G_SHL [[AND9]], [[C1]](s32)
    ; GFX78: [[OR4:%[0-9]+]]:_(s32) = G_OR [[AND8]], [[SHL4]]
    ; GFX78: [[BITCAST4:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR4]](s32)
    ; GFX78: [[CONCAT_VECTORS:%[0-9]+]]:_(<10 x s16>) = G_CONCAT_VECTORS [[BITCAST]](<2 x s16>), [[BITCAST1]](<2 x s16>), [[BITCAST2]](<2 x s16>), [[BITCAST3]](<2 x s16>), [[BITCAST4]](<2 x s16>)
    ; GFX78: S_NOP 0, implicit [[CONCAT_VECTORS]](<10 x s16>)
    ; GFX9-LABEL: name: build_vector_v5s16
    ; GFX9: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX9: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; GFX9: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
    ; GFX9: [[COPY4:%[0-9]+]]:_(s32) = COPY $vgpr4
    ; GFX9: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
    ; GFX9: [[DEF1:%[0-9]+]]:_(<2 x s16>) = G_IMPLICIT_DEF
    ; GFX9: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX9: [[COPY6:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY5]](s32), [[COPY6]](s32)
    ; GFX9: [[COPY7:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX9: [[COPY8:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC1:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY7]](s32), [[COPY8]](s32)
    ; GFX9: [[COPY9:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
    ; GFX9: [[COPY10:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC2:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY9]](s32), [[COPY10]](s32)
    ; GFX9: [[COPY11:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX9: [[COPY12:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC3:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY11]](s32), [[COPY12]](s32)
    ; GFX9: [[COPY13:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX9: [[COPY14:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC4:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY13]](s32), [[COPY14]](s32)
    ; GFX9: [[CONCAT_VECTORS:%[0-9]+]]:_(<10 x s16>) = G_CONCAT_VECTORS [[BUILD_VECTOR_TRUNC]](<2 x s16>), [[BUILD_VECTOR_TRUNC1]](<2 x s16>), [[BUILD_VECTOR_TRUNC2]](<2 x s16>), [[BUILD_VECTOR_TRUNC3]](<2 x s16>), [[BUILD_VECTOR_TRUNC4]](<2 x s16>)
    ; GFX9: S_NOP 0, implicit [[CONCAT_VECTORS]](<10 x s16>)
    %0:_(s32) = COPY $vgpr0
    %1:_(s32) = COPY $vgpr1
    %2:_(s32) = COPY $vgpr2
    %3:_(s32) = COPY $vgpr3
    %4:_(s32) = COPY $vgpr4
    %5:_(s16) = G_TRUNC %0
    %6:_(s16) = G_TRUNC %1
    %7:_(s16) = G_TRUNC %2
    %8:_(s16) = G_TRUNC %3
    %9:_(s16) = G_TRUNC %4
    %10:_(<5 x s16>) = G_BUILD_VECTOR %5, %6, %7, %8, %9
    %11:_(<10 x s16>) = G_CONCAT_VECTORS %10, %10
    S_NOP 0, implicit %11
...

---
name: build_vector_v7s16
body: |
  bb.0:
    liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6

    ; GFX78-LABEL: name: build_vector_v7s16
    ; GFX78: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX78: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX78: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; GFX78: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
    ; GFX78: [[COPY4:%[0-9]+]]:_(s32) = COPY $vgpr4
    ; GFX78: [[COPY5:%[0-9]+]]:_(s32) = COPY $vgpr5
    ; GFX78: [[COPY6:%[0-9]+]]:_(s32) = COPY $vgpr6
    ; GFX78: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
    ; GFX78: [[DEF1:%[0-9]+]]:_(<2 x s16>) = G_IMPLICIT_DEF
    ; GFX78: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; GFX78: [[COPY7:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX78: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY7]], [[C]]
    ; GFX78: [[COPY8:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX78: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY8]], [[C]]
    ; GFX78: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; GFX78: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C1]](s32)
    ; GFX78: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[SHL]]
    ; GFX78: [[BITCAST:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
    ; GFX78: [[COPY9:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX78: [[AND2:%[0-9]+]]:_(s32) = G_AND [[COPY9]], [[C]]
    ; GFX78: [[COPY10:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX78: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY10]], [[C]]
    ; GFX78: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[AND3]], [[C1]](s32)
    ; GFX78: [[OR1:%[0-9]+]]:_(s32) = G_OR [[AND2]], [[SHL1]]
    ; GFX78: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR1]](s32)
    ; GFX78: [[COPY11:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
    ; GFX78: [[AND4:%[0-9]+]]:_(s32) = G_AND [[COPY11]], [[C]]
    ; GFX78: [[COPY12:%[0-9]+]]:_(s32) = COPY [[COPY5]](s32)
    ; GFX78: [[AND5:%[0-9]+]]:_(s32) = G_AND [[COPY12]], [[C]]
    ; GFX78: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[AND5]], [[C1]](s32)
    ; GFX78: [[OR2:%[0-9]+]]:_(s32) = G_OR [[AND4]], [[SHL2]]
    ; GFX78: [[BITCAST2:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR2]](s32)
    ; GFX78: [[COPY13:%[0-9]+]]:_(s32) = COPY [[COPY6]](s32)
    ; GFX78: [[AND6:%[0-9]+]]:_(s32) = G_AND [[COPY13]], [[C]]
    ; GFX78: [[COPY14:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX78: [[AND7:%[0-9]+]]:_(s32) = G_AND [[COPY14]], [[C]]
    ; GFX78: [[SHL3:%[0-9]+]]:_(s32) = G_SHL [[AND7]], [[C1]](s32)
    ; GFX78: [[OR3:%[0-9]+]]:_(s32) = G_OR [[AND6]], [[SHL3]]
    ; GFX78: [[BITCAST3:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR3]](s32)
    ; GFX78: [[COPY15:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX78: [[AND8:%[0-9]+]]:_(s32) = G_AND [[COPY15]], [[C]]
    ; GFX78: [[COPY16:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX78: [[AND9:%[0-9]+]]:_(s32) = G_AND [[COPY16]], [[C]]
    ; GFX78: [[SHL4:%[0-9]+]]:_(s32) = G_SHL [[AND9]], [[C1]](s32)
    ; GFX78: [[OR4:%[0-9]+]]:_(s32) = G_OR [[AND8]], [[SHL4]]
    ; GFX78: [[BITCAST4:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR4]](s32)
    ; GFX78: [[COPY17:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX78: [[AND10:%[0-9]+]]:_(s32) = G_AND [[COPY17]], [[C]]
    ; GFX78: [[COPY18:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
    ; GFX78: [[AND11:%[0-9]+]]:_(s32) = G_AND [[COPY18]], [[C]]
    ; GFX78: [[SHL5:%[0-9]+]]:_(s32) = G_SHL [[AND11]], [[C1]](s32)
    ; GFX78: [[OR5:%[0-9]+]]:_(s32) = G_OR [[AND10]], [[SHL5]]
    ; GFX78: [[BITCAST5:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR5]](s32)
    ; GFX78: [[COPY19:%[0-9]+]]:_(s32) = COPY [[COPY5]](s32)
    ; GFX78: [[AND12:%[0-9]+]]:_(s32) = G_AND [[COPY19]], [[C]]
    ; GFX78: [[COPY20:%[0-9]+]]:_(s32) = COPY [[COPY6]](s32)
    ; GFX78: [[AND13:%[0-9]+]]:_(s32) = G_AND [[COPY20]], [[C]]
    ; GFX78: [[SHL6:%[0-9]+]]:_(s32) = G_SHL [[AND13]], [[C1]](s32)
    ; GFX78: [[OR6:%[0-9]+]]:_(s32) = G_OR [[AND12]], [[SHL6]]
    ; GFX78: [[BITCAST6:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR6]](s32)
    ; GFX78: [[CONCAT_VECTORS:%[0-9]+]]:_(<14 x s16>) = G_CONCAT_VECTORS [[BITCAST]](<2 x s16>), [[BITCAST1]](<2 x s16>), [[BITCAST2]](<2 x s16>), [[BITCAST3]](<2 x s16>), [[BITCAST4]](<2 x s16>), [[BITCAST5]](<2 x s16>), [[BITCAST6]](<2 x s16>)
    ; GFX78: S_NOP 0, implicit [[CONCAT_VECTORS]](<14 x s16>)
    ; GFX9-LABEL: name: build_vector_v7s16
    ; GFX9: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX9: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; GFX9: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
    ; GFX9: [[COPY4:%[0-9]+]]:_(s32) = COPY $vgpr4
    ; GFX9: [[COPY5:%[0-9]+]]:_(s32) = COPY $vgpr5
    ; GFX9: [[COPY6:%[0-9]+]]:_(s32) = COPY $vgpr6
    ; GFX9: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
    ; GFX9: [[DEF1:%[0-9]+]]:_(<2 x s16>) = G_IMPLICIT_DEF
    ; GFX9: [[COPY7:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX9: [[COPY8:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY7]](s32), [[COPY8]](s32)
    ; GFX9: [[COPY9:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX9: [[COPY10:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC1:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY9]](s32), [[COPY10]](s32)
    ; GFX9: [[COPY11:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
    ; GFX9: [[COPY12:%[0-9]+]]:_(s32) = COPY [[COPY5]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC2:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY11]](s32), [[COPY12]](s32)
    ; GFX9: [[COPY13:%[0-9]+]]:_(s32) = COPY [[COPY6]](s32)
    ; GFX9: [[COPY14:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC3:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY13]](s32), [[COPY14]](s32)
    ; GFX9: [[COPY15:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX9: [[COPY16:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC4:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY15]](s32), [[COPY16]](s32)
    ; GFX9: [[COPY17:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX9: [[COPY18:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC5:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY17]](s32), [[COPY18]](s32)
    ; GFX9: [[COPY19:%[0-9]+]]:_(s32) = COPY [[COPY5]](s32)
    ; GFX9: [[COPY20:%[0-9]+]]:_(s32) = COPY [[COPY6]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC6:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY19]](s32), [[COPY20]](s32)
    ; GFX9: [[CONCAT_VECTORS:%[0-9]+]]:_(<14 x s16>) = G_CONCAT_VECTORS [[BUILD_VECTOR_TRUNC]](<2 x s16>), [[BUILD_VECTOR_TRUNC1]](<2 x s16>), [[BUILD_VECTOR_TRUNC2]](<2 x s16>), [[BUILD_VECTOR_TRUNC3]](<2 x s16>), [[BUILD_VECTOR_TRUNC4]](<2 x s16>), [[BUILD_VECTOR_TRUNC5]](<2 x s16>), [[BUILD_VECTOR_TRUNC6]](<2 x s16>)
    ; GFX9: S_NOP 0, implicit [[CONCAT_VECTORS]](<14 x s16>)
    %0:_(s32) = COPY $vgpr0
    %1:_(s32) = COPY $vgpr1
    %2:_(s32) = COPY $vgpr2
    %3:_(s32) = COPY $vgpr3
    %4:_(s32) = COPY $vgpr4
    %5:_(s32) = COPY $vgpr5
    %6:_(s32) = COPY $vgpr6
    %7:_(s16) = G_TRUNC %0
    %8:_(s16) = G_TRUNC %1
    %9:_(s16) = G_TRUNC %2
    %10:_(s16) = G_TRUNC %3
    %11:_(s16) = G_TRUNC %4
    %12:_(s16) = G_TRUNC %5
    %13:_(s16) = G_TRUNC %6
    %14:_(<7 x s16>) = G_BUILD_VECTOR %7, %8, %9, %10, %11, %12, %13
    %15:_(<14 x s16>) = G_CONCAT_VECTORS %14, %14
    S_NOP 0, implicit %15
...

---
name: build_vector_v8s16
body: |
  bb.0:
    liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7

    ; GFX78-LABEL: name: build_vector_v8s16
    ; GFX78: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX78: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX78: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; GFX78: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
    ; GFX78: [[COPY4:%[0-9]+]]:_(s32) = COPY $vgpr4
    ; GFX78: [[COPY5:%[0-9]+]]:_(s32) = COPY $vgpr5
    ; GFX78: [[COPY6:%[0-9]+]]:_(s32) = COPY $vgpr6
    ; GFX78: [[COPY7:%[0-9]+]]:_(s32) = COPY $vgpr7
    ; GFX78: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; GFX78: [[COPY8:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX78: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY8]], [[C]]
    ; GFX78: [[COPY9:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX78: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY9]], [[C]]
    ; GFX78: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; GFX78: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C1]](s32)
    ; GFX78: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[SHL]]
    ; GFX78: [[BITCAST:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
    ; GFX78: [[COPY10:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX78: [[AND2:%[0-9]+]]:_(s32) = G_AND [[COPY10]], [[C]]
    ; GFX78: [[COPY11:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX78: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY11]], [[C]]
    ; GFX78: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[AND3]], [[C1]](s32)
    ; GFX78: [[OR1:%[0-9]+]]:_(s32) = G_OR [[AND2]], [[SHL1]]
    ; GFX78: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR1]](s32)
    ; GFX78: [[COPY12:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
    ; GFX78: [[AND4:%[0-9]+]]:_(s32) = G_AND [[COPY12]], [[C]]
    ; GFX78: [[COPY13:%[0-9]+]]:_(s32) = COPY [[COPY5]](s32)
    ; GFX78: [[AND5:%[0-9]+]]:_(s32) = G_AND [[COPY13]], [[C]]
    ; GFX78: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[AND5]], [[C1]](s32)
    ; GFX78: [[OR2:%[0-9]+]]:_(s32) = G_OR [[AND4]], [[SHL2]]
    ; GFX78: [[BITCAST2:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR2]](s32)
    ; GFX78: [[COPY14:%[0-9]+]]:_(s32) = COPY [[COPY6]](s32)
    ; GFX78: [[AND6:%[0-9]+]]:_(s32) = G_AND [[COPY14]], [[C]]
    ; GFX78: [[COPY15:%[0-9]+]]:_(s32) = COPY [[COPY7]](s32)
    ; GFX78: [[AND7:%[0-9]+]]:_(s32) = G_AND [[COPY15]], [[C]]
    ; GFX78: [[SHL3:%[0-9]+]]:_(s32) = G_SHL [[AND7]], [[C1]](s32)
    ; GFX78: [[OR3:%[0-9]+]]:_(s32) = G_OR [[AND6]], [[SHL3]]
    ; GFX78: [[BITCAST3:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR3]](s32)
    ; GFX78: [[CONCAT_VECTORS:%[0-9]+]]:_(<8 x s16>) = G_CONCAT_VECTORS [[BITCAST]](<2 x s16>), [[BITCAST1]](<2 x s16>), [[BITCAST2]](<2 x s16>), [[BITCAST3]](<2 x s16>)
    ; GFX78: S_NOP 0, implicit [[CONCAT_VECTORS]](<8 x s16>)
    ; GFX9-LABEL: name: build_vector_v8s16
    ; GFX9: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX9: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; GFX9: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
    ; GFX9: [[COPY4:%[0-9]+]]:_(s32) = COPY $vgpr4
    ; GFX9: [[COPY5:%[0-9]+]]:_(s32) = COPY $vgpr5
    ; GFX9: [[COPY6:%[0-9]+]]:_(s32) = COPY $vgpr6
    ; GFX9: [[COPY7:%[0-9]+]]:_(s32) = COPY $vgpr7
    ; GFX9: [[COPY8:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX9: [[COPY9:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY8]](s32), [[COPY9]](s32)
    ; GFX9: [[COPY10:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX9: [[COPY11:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC1:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY10]](s32), [[COPY11]](s32)
    ; GFX9: [[COPY12:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
    ; GFX9: [[COPY13:%[0-9]+]]:_(s32) = COPY [[COPY5]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC2:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY12]](s32), [[COPY13]](s32)
    ; GFX9: [[COPY14:%[0-9]+]]:_(s32) = COPY [[COPY6]](s32)
    ; GFX9: [[COPY15:%[0-9]+]]:_(s32) = COPY [[COPY7]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC3:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY14]](s32), [[COPY15]](s32)
    ; GFX9: [[CONCAT_VECTORS:%[0-9]+]]:_(<8 x s16>) = G_CONCAT_VECTORS [[BUILD_VECTOR_TRUNC]](<2 x s16>), [[BUILD_VECTOR_TRUNC1]](<2 x s16>), [[BUILD_VECTOR_TRUNC2]](<2 x s16>), [[BUILD_VECTOR_TRUNC3]](<2 x s16>)
    ; GFX9: S_NOP 0, implicit [[CONCAT_VECTORS]](<8 x s16>)
    %0:_(s32) = COPY $vgpr0
    %1:_(s32) = COPY $vgpr1
    %2:_(s32) = COPY $vgpr2
    %3:_(s32) = COPY $vgpr3
    %4:_(s32) = COPY $vgpr4
    %5:_(s32) = COPY $vgpr5
    %6:_(s32) = COPY $vgpr6
    %7:_(s32) = COPY $vgpr7
    %8:_(s16) = G_TRUNC %0
    %9:_(s16) = G_TRUNC %1
    %10:_(s16) = G_TRUNC %2
    %11:_(s16) = G_TRUNC %3
    %12:_(s16) = G_TRUNC %4
    %13:_(s16) = G_TRUNC %5
    %14:_(s16) = G_TRUNC %6
    %15:_(s16) = G_TRUNC %7
    %16:_(<8 x s16>) = G_BUILD_VECTOR %8, %9, %10, %11, %12, %13, %14, %15
    S_NOP 0, implicit %16
...

---
name: build_vector_v16s16
body: |
  bb.0:
    liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7, $vgpr8, $vgpr9, $vgpr10, $vgpr11, $vgpr12, $vgpr13, $vgpr14, $vgpr15

    ; GFX78-LABEL: name: build_vector_v16s16
    ; GFX78: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX78: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX78: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; GFX78: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
    ; GFX78: [[COPY4:%[0-9]+]]:_(s32) = COPY $vgpr4
    ; GFX78: [[COPY5:%[0-9]+]]:_(s32) = COPY $vgpr5
    ; GFX78: [[COPY6:%[0-9]+]]:_(s32) = COPY $vgpr6
    ; GFX78: [[COPY7:%[0-9]+]]:_(s32) = COPY $vgpr7
    ; GFX78: [[COPY8:%[0-9]+]]:_(s32) = COPY $vgpr8
    ; GFX78: [[COPY9:%[0-9]+]]:_(s32) = COPY $vgpr9
    ; GFX78: [[COPY10:%[0-9]+]]:_(s32) = COPY $vgpr10
    ; GFX78: [[COPY11:%[0-9]+]]:_(s32) = COPY $vgpr11
    ; GFX78: [[COPY12:%[0-9]+]]:_(s32) = COPY $vgpr12
    ; GFX78: [[COPY13:%[0-9]+]]:_(s32) = COPY $vgpr13
    ; GFX78: [[COPY14:%[0-9]+]]:_(s32) = COPY $vgpr14
    ; GFX78: [[COPY15:%[0-9]+]]:_(s32) = COPY $vgpr15
    ; GFX78: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
    ; GFX78: [[COPY16:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX78: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY16]], [[C]]
    ; GFX78: [[COPY17:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX78: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY17]], [[C]]
    ; GFX78: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; GFX78: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C1]](s32)
    ; GFX78: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[SHL]]
    ; GFX78: [[BITCAST:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
    ; GFX78: [[COPY18:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX78: [[AND2:%[0-9]+]]:_(s32) = G_AND [[COPY18]], [[C]]
    ; GFX78: [[COPY19:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX78: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY19]], [[C]]
    ; GFX78: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[AND3]], [[C1]](s32)
    ; GFX78: [[OR1:%[0-9]+]]:_(s32) = G_OR [[AND2]], [[SHL1]]
    ; GFX78: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR1]](s32)
    ; GFX78: [[COPY20:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
    ; GFX78: [[AND4:%[0-9]+]]:_(s32) = G_AND [[COPY20]], [[C]]
    ; GFX78: [[COPY21:%[0-9]+]]:_(s32) = COPY [[COPY5]](s32)
    ; GFX78: [[AND5:%[0-9]+]]:_(s32) = G_AND [[COPY21]], [[C]]
    ; GFX78: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[AND5]], [[C1]](s32)
    ; GFX78: [[OR2:%[0-9]+]]:_(s32) = G_OR [[AND4]], [[SHL2]]
    ; GFX78: [[BITCAST2:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR2]](s32)
    ; GFX78: [[COPY22:%[0-9]+]]:_(s32) = COPY [[COPY6]](s32)
    ; GFX78: [[AND6:%[0-9]+]]:_(s32) = G_AND [[COPY22]], [[C]]
    ; GFX78: [[COPY23:%[0-9]+]]:_(s32) = COPY [[COPY7]](s32)
    ; GFX78: [[AND7:%[0-9]+]]:_(s32) = G_AND [[COPY23]], [[C]]
    ; GFX78: [[SHL3:%[0-9]+]]:_(s32) = G_SHL [[AND7]], [[C1]](s32)
    ; GFX78: [[OR3:%[0-9]+]]:_(s32) = G_OR [[AND6]], [[SHL3]]
    ; GFX78: [[BITCAST3:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR3]](s32)
    ; GFX78: [[COPY24:%[0-9]+]]:_(s32) = COPY [[COPY8]](s32)
    ; GFX78: [[AND8:%[0-9]+]]:_(s32) = G_AND [[COPY24]], [[C]]
    ; GFX78: [[COPY25:%[0-9]+]]:_(s32) = COPY [[COPY9]](s32)
    ; GFX78: [[AND9:%[0-9]+]]:_(s32) = G_AND [[COPY25]], [[C]]
    ; GFX78: [[SHL4:%[0-9]+]]:_(s32) = G_SHL [[AND9]], [[C1]](s32)
    ; GFX78: [[OR4:%[0-9]+]]:_(s32) = G_OR [[AND8]], [[SHL4]]
    ; GFX78: [[BITCAST4:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR4]](s32)
    ; GFX78: [[COPY26:%[0-9]+]]:_(s32) = COPY [[COPY10]](s32)
    ; GFX78: [[AND10:%[0-9]+]]:_(s32) = G_AND [[COPY26]], [[C]]
    ; GFX78: [[COPY27:%[0-9]+]]:_(s32) = COPY [[COPY11]](s32)
    ; GFX78: [[AND11:%[0-9]+]]:_(s32) = G_AND [[COPY27]], [[C]]
    ; GFX78: [[SHL5:%[0-9]+]]:_(s32) = G_SHL [[AND11]], [[C1]](s32)
    ; GFX78: [[OR5:%[0-9]+]]:_(s32) = G_OR [[AND10]], [[SHL5]]
    ; GFX78: [[BITCAST5:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR5]](s32)
    ; GFX78: [[COPY28:%[0-9]+]]:_(s32) = COPY [[COPY12]](s32)
    ; GFX78: [[AND12:%[0-9]+]]:_(s32) = G_AND [[COPY28]], [[C]]
    ; GFX78: [[COPY29:%[0-9]+]]:_(s32) = COPY [[COPY13]](s32)
    ; GFX78: [[AND13:%[0-9]+]]:_(s32) = G_AND [[COPY29]], [[C]]
    ; GFX78: [[SHL6:%[0-9]+]]:_(s32) = G_SHL [[AND13]], [[C1]](s32)
    ; GFX78: [[OR6:%[0-9]+]]:_(s32) = G_OR [[AND12]], [[SHL6]]
    ; GFX78: [[BITCAST6:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR6]](s32)
    ; GFX78: [[COPY30:%[0-9]+]]:_(s32) = COPY [[COPY14]](s32)
    ; GFX78: [[AND14:%[0-9]+]]:_(s32) = G_AND [[COPY30]], [[C]]
    ; GFX78: [[COPY31:%[0-9]+]]:_(s32) = COPY [[COPY15]](s32)
    ; GFX78: [[AND15:%[0-9]+]]:_(s32) = G_AND [[COPY31]], [[C]]
    ; GFX78: [[SHL7:%[0-9]+]]:_(s32) = G_SHL [[AND15]], [[C1]](s32)
    ; GFX78: [[OR7:%[0-9]+]]:_(s32) = G_OR [[AND14]], [[SHL7]]
    ; GFX78: [[BITCAST7:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR7]](s32)
    ; GFX78: [[CONCAT_VECTORS:%[0-9]+]]:_(<16 x s16>) = G_CONCAT_VECTORS [[BITCAST]](<2 x s16>), [[BITCAST1]](<2 x s16>), [[BITCAST2]](<2 x s16>), [[BITCAST3]](<2 x s16>), [[BITCAST4]](<2 x s16>), [[BITCAST5]](<2 x s16>), [[BITCAST6]](<2 x s16>), [[BITCAST7]](<2 x s16>)
    ; GFX78: S_NOP 0, implicit [[CONCAT_VECTORS]](<16 x s16>)
    ; GFX9-LABEL: name: build_vector_v16s16
    ; GFX9: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
    ; GFX9: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
    ; GFX9: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
    ; GFX9: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr3
    ; GFX9: [[COPY4:%[0-9]+]]:_(s32) = COPY $vgpr4
    ; GFX9: [[COPY5:%[0-9]+]]:_(s32) = COPY $vgpr5
    ; GFX9: [[COPY6:%[0-9]+]]:_(s32) = COPY $vgpr6
    ; GFX9: [[COPY7:%[0-9]+]]:_(s32) = COPY $vgpr7
    ; GFX9: [[COPY8:%[0-9]+]]:_(s32) = COPY $vgpr8
    ; GFX9: [[COPY9:%[0-9]+]]:_(s32) = COPY $vgpr9
    ; GFX9: [[COPY10:%[0-9]+]]:_(s32) = COPY $vgpr10
    ; GFX9: [[COPY11:%[0-9]+]]:_(s32) = COPY $vgpr11
    ; GFX9: [[COPY12:%[0-9]+]]:_(s32) = COPY $vgpr12
    ; GFX9: [[COPY13:%[0-9]+]]:_(s32) = COPY $vgpr13
    ; GFX9: [[COPY14:%[0-9]+]]:_(s32) = COPY $vgpr14
    ; GFX9: [[COPY15:%[0-9]+]]:_(s32) = COPY $vgpr15
    ; GFX9: [[COPY16:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
    ; GFX9: [[COPY17:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY16]](s32), [[COPY17]](s32)
    ; GFX9: [[COPY18:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
    ; GFX9: [[COPY19:%[0-9]+]]:_(s32) = COPY [[COPY3]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC1:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY18]](s32), [[COPY19]](s32)
    ; GFX9: [[COPY20:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
    ; GFX9: [[COPY21:%[0-9]+]]:_(s32) = COPY [[COPY5]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC2:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY20]](s32), [[COPY21]](s32)
    ; GFX9: [[COPY22:%[0-9]+]]:_(s32) = COPY [[COPY6]](s32)
    ; GFX9: [[COPY23:%[0-9]+]]:_(s32) = COPY [[COPY7]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC3:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY22]](s32), [[COPY23]](s32)
    ; GFX9: [[COPY24:%[0-9]+]]:_(s32) = COPY [[COPY8]](s32)
    ; GFX9: [[COPY25:%[0-9]+]]:_(s32) = COPY [[COPY9]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC4:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY24]](s32), [[COPY25]](s32)
    ; GFX9: [[COPY26:%[0-9]+]]:_(s32) = COPY [[COPY10]](s32)
    ; GFX9: [[COPY27:%[0-9]+]]:_(s32) = COPY [[COPY11]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC5:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY26]](s32), [[COPY27]](s32)
    ; GFX9: [[COPY28:%[0-9]+]]:_(s32) = COPY [[COPY12]](s32)
    ; GFX9: [[COPY29:%[0-9]+]]:_(s32) = COPY [[COPY13]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC6:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY28]](s32), [[COPY29]](s32)
    ; GFX9: [[COPY30:%[0-9]+]]:_(s32) = COPY [[COPY14]](s32)
    ; GFX9: [[COPY31:%[0-9]+]]:_(s32) = COPY [[COPY15]](s32)
    ; GFX9: [[BUILD_VECTOR_TRUNC7:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[COPY30]](s32), [[COPY31]](s32)
    ; GFX9: [[CONCAT_VECTORS:%[0-9]+]]:_(<16 x s16>) = G_CONCAT_VECTORS [[BUILD_VECTOR_TRUNC]](<2 x s16>), [[BUILD_VECTOR_TRUNC1]](<2 x s16>), [[BUILD_VECTOR_TRUNC2]](<2 x s16>), [[BUILD_VECTOR_TRUNC3]](<2 x s16>), [[BUILD_VECTOR_TRUNC4]](<2 x s16>), [[BUILD_VECTOR_TRUNC5]](<2 x s16>), [[BUILD_VECTOR_TRUNC6]](<2 x s16>), [[BUILD_VECTOR_TRUNC7]](<2 x s16>)
    ; GFX9: S_NOP 0, implicit [[CONCAT_VECTORS]](<16 x s16>)
    %0:_(s32) = COPY $vgpr0
    %1:_(s32) = COPY $vgpr1
    %2:_(s32) = COPY $vgpr2
    %3:_(s32) = COPY $vgpr3
    %4:_(s32) = COPY $vgpr4
    %5:_(s32) = COPY $vgpr5
    %6:_(s32) = COPY $vgpr6
    %7:_(s32) = COPY $vgpr7
    %8:_(s32) = COPY $vgpr8
    %9:_(s32) = COPY $vgpr9
    %10:_(s32) = COPY $vgpr10
    %11:_(s32) = COPY $vgpr11
    %12:_(s32) = COPY $vgpr12
    %13:_(s32) = COPY $vgpr13
    %14:_(s32) = COPY $vgpr14
    %15:_(s32) = COPY $vgpr15
    %16:_(s16) = G_TRUNC %0
    %17:_(s16) = G_TRUNC %1
    %18:_(s16) = G_TRUNC %2
    %19:_(s16) = G_TRUNC %3
    %20:_(s16) = G_TRUNC %4
    %21:_(s16) = G_TRUNC %5
    %22:_(s16) = G_TRUNC %6
    %23:_(s16) = G_TRUNC %7
    %24:_(s16) = G_TRUNC %8
    %25:_(s16) = G_TRUNC %9
    %26:_(s16) = G_TRUNC %10
    %27:_(s16) = G_TRUNC %11
    %28:_(s16) = G_TRUNC %12
    %29:_(s16) = G_TRUNC %13
    %30:_(s16) = G_TRUNC %14
    %31:_(s16) = G_TRUNC %15
    %32:_(<16 x s16>) = G_BUILD_VECTOR  %16, %17, %18, %19, %20, %21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31
    S_NOP 0, implicit %32
...