Generate separate stores for partially swizzled memory stores

Full vector and fully specified vector swizzle stores are not affected by this change, only partial swizzles ie swizzles with fewer components than the vector being stored to.

Previously the vector being stored to loaded and any components not specified in the swizzle were used to create a full store to the vector.

While this change generates more SPIR-V instructions, it is necessary for correctness.

Fixes #2518.
This commit is contained in:
Jeremy Hayes 2021-07-16 15:07:16 -06:00
parent 9158061398
commit 6d5b40f051
50 changed files with 31343 additions and 26594 deletions

View file

@ -1,7 +1,7 @@
spv.int16.amd.frag
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 560
// Id's are bound by 576
Capability Shader
Capability Float16
@ -14,7 +14,7 @@ spv.int16.amd.frag
Extension "SPV_KHR_16bit_storage"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 519 521
EntryPoint Fragment 4 "main" 535 537
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_AMD_gpu_shader_half_float"
@ -54,66 +54,66 @@ spv.int16.amd.frag
Name 393 "f16v"
Name 396 "exp"
Name 397 "ResType"
Name 418 "packi"
Name 423 "packu"
Name 432 "packi64"
Name 441 "packu64"
Name 450 "bv"
Name 515 "Block"
MemberName 515(Block) 0 "i16v"
MemberName 515(Block) 1 "u16"
Name 517 "block"
Name 519 "iu16v"
Name 521 "ii16"
Name 522 "si64"
Name 523 "su64"
Name 524 "si"
Name 525 "su"
Name 526 "sb"
Name 527 "si16"
Name 528 "su16"
Name 529 "i16_to_b"
Name 530 "u16_to_b"
Name 531 "b_to_i16"
Name 532 "b_to_u16"
Name 533 "i16_to_i"
Name 535 "u16_to_i"
Name 536 "i_to_i16"
Name 538 "i_to_u16"
Name 540 "i16_to_u"
Name 541 "u16_to_u"
Name 543 "u_to_i16"
Name 544 "u_to_u16"
Name 545 "i16_to_i64"
Name 548 "u16_to_i64"
Name 549 "i64_to_i16"
Name 551 "i64_to_u16"
Name 553 "i16_to_u64"
Name 554 "u16_to_u64"
Name 556 "u64_to_i16"
Name 557 "u64_to_u16"
Name 558 "i16_to_u16"
Name 559 "u16_to_i16"
Name 420 "packi"
Name 425 "packu"
Name 436 "packi64"
Name 445 "packu64"
Name 454 "bv"
Name 531 "Block"
MemberName 531(Block) 0 "i16v"
MemberName 531(Block) 1 "u16"
Name 533 "block"
Name 535 "iu16v"
Name 537 "ii16"
Name 538 "si64"
Name 539 "su64"
Name 540 "si"
Name 541 "su"
Name 542 "sb"
Name 543 "si16"
Name 544 "su16"
Name 545 "i16_to_b"
Name 546 "u16_to_b"
Name 547 "b_to_i16"
Name 548 "b_to_u16"
Name 549 "i16_to_i"
Name 551 "u16_to_i"
Name 552 "i_to_i16"
Name 554 "i_to_u16"
Name 556 "i16_to_u"
Name 557 "u16_to_u"
Name 559 "u_to_i16"
Name 560 "u_to_u16"
Name 561 "i16_to_i64"
Name 564 "u16_to_i64"
Name 565 "i64_to_i16"
Name 567 "i64_to_u16"
Name 569 "i16_to_u64"
Name 570 "u16_to_u64"
Name 572 "u64_to_i16"
Name 573 "u64_to_u16"
Name 574 "i16_to_u16"
Name 575 "u16_to_i16"
MemberDecorate 25(Uniforms) 0 Offset 0
Decorate 25(Uniforms) Block
Decorate 27 DescriptorSet 0
Decorate 27 Binding 0
MemberDecorate 515(Block) 0 Offset 0
MemberDecorate 515(Block) 1 Offset 6
Decorate 515(Block) Block
Decorate 517(block) DescriptorSet 0
Decorate 517(block) Binding 1
Decorate 519(iu16v) Flat
Decorate 519(iu16v) Location 0
Decorate 521(ii16) Flat
Decorate 521(ii16) Location 1
Decorate 522(si64) SpecId 100
Decorate 523(su64) SpecId 101
Decorate 524(si) SpecId 102
Decorate 525(su) SpecId 103
Decorate 526(sb) SpecId 104
Decorate 527(si16) SpecId 105
Decorate 528(su16) SpecId 106
MemberDecorate 531(Block) 0 Offset 0
MemberDecorate 531(Block) 1 Offset 6
Decorate 531(Block) Block
Decorate 533(block) DescriptorSet 0
Decorate 533(block) Binding 1
Decorate 535(iu16v) Flat
Decorate 535(iu16v) Location 0
Decorate 537(ii16) Flat
Decorate 537(ii16) Location 1
Decorate 538(si64) SpecId 100
Decorate 539(su64) SpecId 101
Decorate 540(si) SpecId 102
Decorate 541(su) SpecId 103
Decorate 542(sb) SpecId 104
Decorate 543(si16) SpecId 105
Decorate 544(su16) SpecId 106
2: TypeVoid
3: TypeFunction 2
14: TypeInt 16 0
@ -194,62 +194,62 @@ spv.int16.amd.frag
395: TypePointer Function 54(i16vec3)
397(ResType): TypeStruct 391(f16vec3) 54(i16vec3)
407: TypePointer Function 261(float16_t)
431: TypePointer Function 273(int64_t)
434: TypeVector 17(int16_t) 4
440: TypePointer Function 285(int64_t)
443: TypeVector 14(int16_t) 4
449: TypePointer Function 388(bvec3)
515(Block): TypeStruct 54(i16vec3) 14(int16_t)
516: TypePointer Uniform 515(Block)
517(block): 516(ptr) Variable Uniform
518: TypePointer Input 49(i16vec3)
519(iu16v): 518(ptr) Variable Input
520: TypePointer Input 17(int16_t)
521(ii16): 520(ptr) Variable Input
522(si64):273(int64_t) SpecConstant 4294967286 4294967295
523(su64):285(int64_t) SpecConstant 20 0
524(si): 28(int) SpecConstant 4294967291
525(su): 18(int) SpecConstant 4
526(sb): 125(bool) SpecConstantTrue
527(si16): 17(int16_t) SpecConstant 4294967291
528(su16): 14(int16_t) SpecConstant 4
529(i16_to_b): 125(bool) SpecConstantOp 171 527(si16) 202
530(u16_to_b): 125(bool) SpecConstantOp 171 528(su16) 202
531(b_to_i16): 17(int16_t) SpecConstantOp 169 526(sb) 53 194
532(b_to_u16): 14(int16_t) SpecConstantOp 169 526(sb) 203 202
533(i16_to_i): 28(int) SpecConstantOp 114 527(si16)
534: 18(int) SpecConstantOp 113 528(su16)
535(u16_to_i): 28(int) SpecConstantOp 128 534 128
536(i_to_i16): 17(int16_t) SpecConstantOp 114 524(si)
537: 17(int16_t) SpecConstantOp 114 524(si)
538(i_to_u16): 14(int16_t) SpecConstantOp 128 537 202
539: 28(int) SpecConstantOp 114 527(si16)
540(i16_to_u): 18(int) SpecConstantOp 128 539 128
541(u16_to_u): 18(int) SpecConstantOp 113 528(su16)
542: 14(int16_t) SpecConstantOp 113 525(su)
543(u_to_i16): 17(int16_t) SpecConstantOp 128 542 202
544(u_to_u16): 14(int16_t) SpecConstantOp 113 525(su)
545(i16_to_i64):273(int64_t) SpecConstantOp 114 527(si16)
546:285(int64_t) SpecConstantOp 113 528(su16)
547:285(int64_t) Constant 0 0
548(u16_to_i64):273(int64_t) SpecConstantOp 128 546 547
549(i64_to_i16): 17(int16_t) SpecConstantOp 114 522(si64)
550: 17(int16_t) SpecConstantOp 114 522(si64)
551(i64_to_u16): 14(int16_t) SpecConstantOp 128 550 202
552:273(int64_t) SpecConstantOp 114 527(si16)
553(i16_to_u64):285(int64_t) SpecConstantOp 128 552 547
554(u16_to_u64):285(int64_t) SpecConstantOp 113 528(su16)
555: 14(int16_t) SpecConstantOp 113 523(su64)
556(u64_to_i16): 17(int16_t) SpecConstantOp 128 555 202
557(u64_to_u16): 14(int16_t) SpecConstantOp 113 523(su64)
558(i16_to_u16): 14(int16_t) SpecConstantOp 128 527(si16) 202
559(u16_to_i16): 17(int16_t) SpecConstantOp 128 528(su16) 202
435: TypePointer Function 273(int64_t)
438: TypeVector 17(int16_t) 4
444: TypePointer Function 285(int64_t)
447: TypeVector 14(int16_t) 4
453: TypePointer Function 388(bvec3)
531(Block): TypeStruct 54(i16vec3) 14(int16_t)
532: TypePointer Uniform 531(Block)
533(block): 532(ptr) Variable Uniform
534: TypePointer Input 49(i16vec3)
535(iu16v): 534(ptr) Variable Input
536: TypePointer Input 17(int16_t)
537(ii16): 536(ptr) Variable Input
538(si64):273(int64_t) SpecConstant 4294967286 4294967295
539(su64):285(int64_t) SpecConstant 20 0
540(si): 28(int) SpecConstant 4294967291
541(su): 18(int) SpecConstant 4
542(sb): 125(bool) SpecConstantTrue
543(si16): 17(int16_t) SpecConstant 4294967291
544(su16): 14(int16_t) SpecConstant 4
545(i16_to_b): 125(bool) SpecConstantOp 171 543(si16) 202
546(u16_to_b): 125(bool) SpecConstantOp 171 544(su16) 202
547(b_to_i16): 17(int16_t) SpecConstantOp 169 542(sb) 53 194
548(b_to_u16): 14(int16_t) SpecConstantOp 169 542(sb) 203 202
549(i16_to_i): 28(int) SpecConstantOp 114 543(si16)
550: 18(int) SpecConstantOp 113 544(su16)
551(u16_to_i): 28(int) SpecConstantOp 128 550 128
552(i_to_i16): 17(int16_t) SpecConstantOp 114 540(si)
553: 17(int16_t) SpecConstantOp 114 540(si)
554(i_to_u16): 14(int16_t) SpecConstantOp 128 553 202
555: 28(int) SpecConstantOp 114 543(si16)
556(i16_to_u): 18(int) SpecConstantOp 128 555 128
557(u16_to_u): 18(int) SpecConstantOp 113 544(su16)
558: 14(int16_t) SpecConstantOp 113 541(su)
559(u_to_i16): 17(int16_t) SpecConstantOp 128 558 202
560(u_to_u16): 14(int16_t) SpecConstantOp 113 541(su)
561(i16_to_i64):273(int64_t) SpecConstantOp 114 543(si16)
562:285(int64_t) SpecConstantOp 113 544(su16)
563:285(int64_t) Constant 0 0
564(u16_to_i64):273(int64_t) SpecConstantOp 128 562 563
565(i64_to_i16): 17(int16_t) SpecConstantOp 114 538(si64)
566: 17(int16_t) SpecConstantOp 114 538(si64)
567(i64_to_u16): 14(int16_t) SpecConstantOp 128 566 202
568:273(int64_t) SpecConstantOp 114 543(si16)
569(i16_to_u64):285(int64_t) SpecConstantOp 128 568 563
570(u16_to_u64):285(int64_t) SpecConstantOp 113 544(su16)
571: 14(int16_t) SpecConstantOp 113 539(su64)
572(u64_to_i16): 17(int16_t) SpecConstantOp 128 571 202
573(u64_to_u16): 14(int16_t) SpecConstantOp 113 539(su64)
574(i16_to_u16): 14(int16_t) SpecConstantOp 128 543(si16) 202
575(u16_to_i16): 17(int16_t) SpecConstantOp 128 544(su16) 202
4(main): 2 Function None 3
5: Label
511: 2 FunctionCall 6(literal()
512: 2 FunctionCall 8(operators()
513: 2 FunctionCall 10(typeCast()
514: 2 FunctionCall 12(builtinFuncs()
527: 2 FunctionCall 6(literal()
528: 2 FunctionCall 8(operators()
529: 2 FunctionCall 10(typeCast()
530: 2 FunctionCall 12(builtinFuncs()
Return
FunctionEnd
6(literal(): 2 Function None 3
@ -568,11 +568,11 @@ spv.int16.amd.frag
321(u16): 15(ptr) Variable Function
393(f16v): 392(ptr) Variable Function
396(exp): 395(ptr) Variable Function
418(packi): 158(ptr) Variable Function
423(packu): 147(ptr) Variable Function
432(packi64): 431(ptr) Variable Function
441(packu64): 440(ptr) Variable Function
450(bv): 449(ptr) Variable Function
420(packi): 158(ptr) Variable Function
425(packu): 147(ptr) Variable Function
436(packi64): 435(ptr) Variable Function
445(packu64): 444(ptr) Variable Function
454(bv): 453(ptr) Variable Function
306:187(i16vec2) Load 305(i16v)
307:187(i16vec2) ExtInst 1(GLSL.std.450) 5(SAbs) 306
Store 305(i16v) 307
@ -686,114 +686,138 @@ spv.int16.amd.frag
Store 411 410
412:187(i16vec2) Load 305(i16v)
413:262(f16vec2) Bitcast 412
414:391(f16vec3) Load 393(f16v)
415:391(f16vec3) VectorShuffle 414 413 3 4 2
Store 393(f16v) 415
416: 49(i16vec3) Load 319(u16v)
417:391(f16vec3) Bitcast 416
Store 393(f16v) 417
419:187(i16vec2) Load 305(i16v)
420: 28(int) Bitcast 419
Store 418(packi) 420
421: 28(int) Load 418(packi)
422:187(i16vec2) Bitcast 421
Store 305(i16v) 422
424: 49(i16vec3) Load 319(u16v)
425:198(i16vec2) VectorShuffle 424 424 0 1
426: 18(int) Bitcast 425
Store 423(packu) 426
427: 18(int) Load 423(packu)
428:198(i16vec2) Bitcast 427
429: 49(i16vec3) Load 319(u16v)
430: 49(i16vec3) VectorShuffle 429 428 3 4 2
Store 319(u16v) 430
433: 17(int16_t) Load 311(i16)
435:434(i16vec4) CompositeConstruct 433 433 433 433
436:273(int64_t) Bitcast 435
Store 432(packi64) 436
437:273(int64_t) Load 432(packi64)
438:434(i16vec4) Bitcast 437
439:187(i16vec2) VectorShuffle 438 438 0 1
Store 305(i16v) 439
442: 14(int16_t) Load 321(u16)
444:443(i16vec4) CompositeConstruct 442 442 442 442
445:285(int64_t) Bitcast 444
Store 441(packu64) 445
446:285(int64_t) Load 441(packu64)
447:443(i16vec4) Bitcast 446
448: 49(i16vec3) VectorShuffle 447 447 0 1 2
Store 319(u16v) 448
451: 49(i16vec3) Load 319(u16v)
452: 14(int16_t) Load 321(u16)
453: 49(i16vec3) CompositeConstruct 452 452 452
454: 388(bvec3) ULessThan 451 453
Store 450(bv) 454
455:187(i16vec2) Load 305(i16v)
456: 17(int16_t) Load 311(i16)
457:187(i16vec2) CompositeConstruct 456 456
458: 190(bvec2) SLessThan 455 457
459: 388(bvec3) Load 450(bv)
460: 388(bvec3) VectorShuffle 459 458 3 4 2
Store 450(bv) 460
461: 49(i16vec3) Load 319(u16v)
462: 14(int16_t) Load 321(u16)
463: 49(i16vec3) CompositeConstruct 462 462 462
464: 388(bvec3) ULessThanEqual 461 463
Store 450(bv) 464
465:187(i16vec2) Load 305(i16v)
466: 17(int16_t) Load 311(i16)
467:187(i16vec2) CompositeConstruct 466 466
468: 190(bvec2) SLessThanEqual 465 467
469: 388(bvec3) Load 450(bv)
470: 388(bvec3) VectorShuffle 469 468 3 4 2
Store 450(bv) 470
471: 49(i16vec3) Load 319(u16v)
472: 14(int16_t) Load 321(u16)
473: 49(i16vec3) CompositeConstruct 472 472 472
474: 388(bvec3) UGreaterThan 471 473
Store 450(bv) 474
475:187(i16vec2) Load 305(i16v)
476: 17(int16_t) Load 311(i16)
477:187(i16vec2) CompositeConstruct 476 476
478: 190(bvec2) SGreaterThan 475 477
479: 388(bvec3) Load 450(bv)
480: 388(bvec3) VectorShuffle 479 478 3 4 2
Store 450(bv) 480
481: 49(i16vec3) Load 319(u16v)
482: 14(int16_t) Load 321(u16)
483: 49(i16vec3) CompositeConstruct 482 482 482
484: 388(bvec3) UGreaterThanEqual 481 483
Store 450(bv) 484
485:187(i16vec2) Load 305(i16v)
486: 17(int16_t) Load 311(i16)
487:187(i16vec2) CompositeConstruct 486 486
488: 190(bvec2) SGreaterThanEqual 485 487
489: 388(bvec3) Load 450(bv)
490: 388(bvec3) VectorShuffle 489 488 3 4 2
Store 450(bv) 490
414: 407(ptr) AccessChain 393(f16v) 128
415:261(float16_t) CompositeExtract 413 0
Store 414 415
416: 407(ptr) AccessChain 393(f16v) 111
417:261(float16_t) CompositeExtract 413 1
Store 416 417
418: 49(i16vec3) Load 319(u16v)
419:391(f16vec3) Bitcast 418
Store 393(f16v) 419
421:187(i16vec2) Load 305(i16v)
422: 28(int) Bitcast 421
Store 420(packi) 422
423: 28(int) Load 420(packi)
424:187(i16vec2) Bitcast 423
Store 305(i16v) 424
426: 49(i16vec3) Load 319(u16v)
427:198(i16vec2) VectorShuffle 426 426 0 1
428: 18(int) Bitcast 427
Store 425(packu) 428
429: 18(int) Load 425(packu)
430:198(i16vec2) Bitcast 429
431: 15(ptr) AccessChain 319(u16v) 128
432: 14(int16_t) CompositeExtract 430 0
Store 431 432
433: 15(ptr) AccessChain 319(u16v) 111
434: 14(int16_t) CompositeExtract 430 1
Store 433 434
437: 17(int16_t) Load 311(i16)
439:438(i16vec4) CompositeConstruct 437 437 437 437
440:273(int64_t) Bitcast 439
Store 436(packi64) 440
441:273(int64_t) Load 436(packi64)
442:438(i16vec4) Bitcast 441
443:187(i16vec2) VectorShuffle 442 442 0 1
Store 305(i16v) 443
446: 14(int16_t) Load 321(u16)
448:447(i16vec4) CompositeConstruct 446 446 446 446
449:285(int64_t) Bitcast 448
Store 445(packu64) 449
450:285(int64_t) Load 445(packu64)
451:447(i16vec4) Bitcast 450
452: 49(i16vec3) VectorShuffle 451 451 0 1 2
Store 319(u16v) 452
455: 49(i16vec3) Load 319(u16v)
456: 14(int16_t) Load 321(u16)
457: 49(i16vec3) CompositeConstruct 456 456 456
458: 388(bvec3) ULessThan 455 457
Store 454(bv) 458
459:187(i16vec2) Load 305(i16v)
460: 17(int16_t) Load 311(i16)
461:187(i16vec2) CompositeConstruct 460 460
462: 190(bvec2) SLessThan 459 461
463: 126(ptr) AccessChain 454(bv) 128
464: 125(bool) CompositeExtract 462 0
Store 463 464
465: 126(ptr) AccessChain 454(bv) 111
466: 125(bool) CompositeExtract 462 1
Store 465 466
467: 49(i16vec3) Load 319(u16v)
468: 14(int16_t) Load 321(u16)
469: 49(i16vec3) CompositeConstruct 468 468 468
470: 388(bvec3) ULessThanEqual 467 469
Store 454(bv) 470
471:187(i16vec2) Load 305(i16v)
472: 17(int16_t) Load 311(i16)
473:187(i16vec2) CompositeConstruct 472 472
474: 190(bvec2) SLessThanEqual 471 473
475: 126(ptr) AccessChain 454(bv) 128
476: 125(bool) CompositeExtract 474 0
Store 475 476
477: 126(ptr) AccessChain 454(bv) 111
478: 125(bool) CompositeExtract 474 1
Store 477 478
479: 49(i16vec3) Load 319(u16v)
480: 14(int16_t) Load 321(u16)
481: 49(i16vec3) CompositeConstruct 480 480 480
482: 388(bvec3) UGreaterThan 479 481
Store 454(bv) 482
483:187(i16vec2) Load 305(i16v)
484: 17(int16_t) Load 311(i16)
485:187(i16vec2) CompositeConstruct 484 484
486: 190(bvec2) SGreaterThan 483 485
487: 126(ptr) AccessChain 454(bv) 128
488: 125(bool) CompositeExtract 486 0
Store 487 488
489: 126(ptr) AccessChain 454(bv) 111
490: 125(bool) CompositeExtract 486 1
Store 489 490
491: 49(i16vec3) Load 319(u16v)
492: 14(int16_t) Load 321(u16)
493: 49(i16vec3) CompositeConstruct 492 492 492
494: 388(bvec3) IEqual 491 493
Store 450(bv) 494
494: 388(bvec3) UGreaterThanEqual 491 493
Store 454(bv) 494
495:187(i16vec2) Load 305(i16v)
496: 17(int16_t) Load 311(i16)
497:187(i16vec2) CompositeConstruct 496 496
498: 190(bvec2) IEqual 495 497
499: 388(bvec3) Load 450(bv)
500: 388(bvec3) VectorShuffle 499 498 3 4 2
Store 450(bv) 500
501: 49(i16vec3) Load 319(u16v)
502: 14(int16_t) Load 321(u16)
503: 49(i16vec3) CompositeConstruct 502 502 502
504: 388(bvec3) INotEqual 501 503
Store 450(bv) 504
505:187(i16vec2) Load 305(i16v)
506: 17(int16_t) Load 311(i16)
507:187(i16vec2) CompositeConstruct 506 506
508: 190(bvec2) INotEqual 505 507
509: 388(bvec3) Load 450(bv)
510: 388(bvec3) VectorShuffle 509 508 3 4 2
Store 450(bv) 510
498: 190(bvec2) SGreaterThanEqual 495 497
499: 126(ptr) AccessChain 454(bv) 128
500: 125(bool) CompositeExtract 498 0
Store 499 500
501: 126(ptr) AccessChain 454(bv) 111
502: 125(bool) CompositeExtract 498 1
Store 501 502
503: 49(i16vec3) Load 319(u16v)
504: 14(int16_t) Load 321(u16)
505: 49(i16vec3) CompositeConstruct 504 504 504
506: 388(bvec3) IEqual 503 505
Store 454(bv) 506
507:187(i16vec2) Load 305(i16v)
508: 17(int16_t) Load 311(i16)
509:187(i16vec2) CompositeConstruct 508 508
510: 190(bvec2) IEqual 507 509
511: 126(ptr) AccessChain 454(bv) 128
512: 125(bool) CompositeExtract 510 0
Store 511 512
513: 126(ptr) AccessChain 454(bv) 111
514: 125(bool) CompositeExtract 510 1
Store 513 514
515: 49(i16vec3) Load 319(u16v)
516: 14(int16_t) Load 321(u16)
517: 49(i16vec3) CompositeConstruct 516 516 516
518: 388(bvec3) INotEqual 515 517
Store 454(bv) 518
519:187(i16vec2) Load 305(i16v)
520: 17(int16_t) Load 311(i16)
521:187(i16vec2) CompositeConstruct 520 520
522: 190(bvec2) INotEqual 519 521
523: 126(ptr) AccessChain 454(bv) 128
524: 125(bool) CompositeExtract 522 0
Store 523 524
525: 126(ptr) AccessChain 454(bv) 111
526: 125(bool) CompositeExtract 522 1
Store 525 526
Return
FunctionEnd