Generate vector constructions more efficiently when sizes match

When two vectors are the same size, there is no need to extract the
components and construct a new vector.
This commit is contained in:
Arcady Goldmints-Orlov 2024-06-21 14:07:50 -04:00 committed by arcady-lunarg
parent 2d8b71fc63
commit 33d517470e
13 changed files with 1777 additions and 1867 deletions

View file

@ -1,7 +1,7 @@
spv.explicittypes.frag
// Module Version 10300
// Generated by (magic number): 8000b
// Id's are bound by 576
// Id's are bound by 567
Capability Shader
Capability Float16
@ -80,63 +80,63 @@ spv.explicittypes.frag
Name 399 "f64v"
Name 406 "i8v"
Name 412 "i16v"
Name 429 "u8v"
Name 435 "u16v"
Name 452 "f16v"
Name 465 "bv"
Name 481 "u64v"
Name 482 "i64v"
Name 485 "f64v"
Name 490 "i8v"
Name 496 "i16v"
Name 502 "i32v"
Name 510 "u8v"
Name 516 "u16v"
Name 522 "u32v"
Name 534 "f16v"
Name 537 "f32v"
Name 548 "bv"
Name 573 "Block"
MemberName 573(Block) 0 "i16"
MemberName 573(Block) 1 "i16v2"
MemberName 573(Block) 2 "i16v3"
MemberName 573(Block) 3 "i16v4"
MemberName 573(Block) 4 "u16"
MemberName 573(Block) 5 "u16v2"
MemberName 573(Block) 6 "u16v3"
MemberName 573(Block) 7 "u16v4"
MemberName 573(Block) 8 "i32"
MemberName 573(Block) 9 "i32v2"
MemberName 573(Block) 10 "i32v3"
MemberName 573(Block) 11 "i32v4"
MemberName 573(Block) 12 "u32"
MemberName 573(Block) 13 "u32v2"
MemberName 573(Block) 14 "u32v3"
MemberName 573(Block) 15 "u32v4"
Name 575 "block"
Name 426 "u8v"
Name 432 "u16v"
Name 446 "f16v"
Name 459 "bv"
Name 475 "u64v"
Name 476 "i64v"
Name 479 "f64v"
Name 484 "i8v"
Name 490 "i16v"
Name 496 "i32v"
Name 504 "u8v"
Name 510 "u16v"
Name 516 "u32v"
Name 525 "f16v"
Name 528 "f32v"
Name 539 "bv"
Name 564 "Block"
MemberName 564(Block) 0 "i16"
MemberName 564(Block) 1 "i16v2"
MemberName 564(Block) 2 "i16v3"
MemberName 564(Block) 3 "i16v4"
MemberName 564(Block) 4 "u16"
MemberName 564(Block) 5 "u16v2"
MemberName 564(Block) 6 "u16v3"
MemberName 564(Block) 7 "u16v4"
MemberName 564(Block) 8 "i32"
MemberName 564(Block) 9 "i32v2"
MemberName 564(Block) 10 "i32v3"
MemberName 564(Block) 11 "i32v4"
MemberName 564(Block) 12 "u32"
MemberName 564(Block) 13 "u32v2"
MemberName 564(Block) 14 "u32v3"
MemberName 564(Block) 15 "u32v4"
Name 566 "block"
MemberDecorate 26(Uniforms) 0 Offset 0
Decorate 26(Uniforms) Block
Decorate 28 DescriptorSet 0
Decorate 28 Binding 0
MemberDecorate 573(Block) 0 Offset 0
MemberDecorate 573(Block) 1 Offset 4
MemberDecorate 573(Block) 2 Offset 8
MemberDecorate 573(Block) 3 Offset 16
MemberDecorate 573(Block) 4 Offset 24
MemberDecorate 573(Block) 5 Offset 28
MemberDecorate 573(Block) 6 Offset 32
MemberDecorate 573(Block) 7 Offset 40
MemberDecorate 573(Block) 8 Offset 48
MemberDecorate 573(Block) 9 Offset 56
MemberDecorate 573(Block) 10 Offset 64
MemberDecorate 573(Block) 11 Offset 80
MemberDecorate 573(Block) 12 Offset 96
MemberDecorate 573(Block) 13 Offset 104
MemberDecorate 573(Block) 14 Offset 112
MemberDecorate 573(Block) 15 Offset 128
Decorate 573(Block) Block
Decorate 575(block) DescriptorSet 0
Decorate 575(block) Binding 1
MemberDecorate 564(Block) 0 Offset 0
MemberDecorate 564(Block) 1 Offset 4
MemberDecorate 564(Block) 2 Offset 8
MemberDecorate 564(Block) 3 Offset 16
MemberDecorate 564(Block) 4 Offset 24
MemberDecorate 564(Block) 5 Offset 28
MemberDecorate 564(Block) 6 Offset 32
MemberDecorate 564(Block) 7 Offset 40
MemberDecorate 564(Block) 8 Offset 48
MemberDecorate 564(Block) 9 Offset 56
MemberDecorate 564(Block) 10 Offset 64
MemberDecorate 564(Block) 11 Offset 80
MemberDecorate 564(Block) 12 Offset 96
MemberDecorate 564(Block) 13 Offset 104
MemberDecorate 564(Block) 14 Offset 112
MemberDecorate 564(Block) 15 Offset 128
Decorate 564(Block) Block
Decorate 566(block) DescriptorSet 0
Decorate 566(block) Binding 1
2: TypeVoid
3: TypeFunction 2
16: TypeInt 64 1
@ -249,32 +249,32 @@ spv.explicittypes.frag
372: 91(int16_t) Constant 1
373:145(i16vec2) ConstantComposite 371 371
374:145(i16vec2) ConstantComposite 372 372
467: 29(int) Constant 1
468: 148(ivec2) ConstantComposite 30 30
469: 148(ivec2) ConstantComposite 467 467
472: 19(int) Constant 0
473: 19(int) Constant 1
474: 154(ivec2) ConstantComposite 472 472
475: 154(ivec2) ConstantComposite 473 473
550: 16(int64_t) Constant 0 0
551: 16(int64_t) Constant 1 0
552:162(i64vec2) ConstantComposite 550 550
553:162(i64vec2) ConstantComposite 551 551
556: 38(int64_t) Constant 0 0
557: 38(int64_t) Constant 1 0
558:167(i64vec2) ConstantComposite 556 556
559:167(i64vec2) ConstantComposite 557 557
565: TypeVector 77(int16_t) 3
566: TypeVector 77(int16_t) 4
567: TypeVector 91(int16_t) 3
568: TypeVector 91(int16_t) 4
569: TypeVector 29(int) 3
570: TypeVector 29(int) 4
571: TypeVector 19(int) 3
572: TypeVector 19(int) 4
573(Block): TypeStruct 77(int16_t) 139(i16vec2) 565(i16vec3) 566(i16vec4) 91(int16_t) 145(i16vec2) 567(i16vec3) 568(i16vec4) 29(int) 148(ivec2) 569(ivec3) 570(ivec4) 19(int) 154(ivec2) 571(ivec3) 572(ivec4)
574: TypePointer Uniform 573(Block)
575(block): 574(ptr) Variable Uniform
461: 29(int) Constant 1
462: 148(ivec2) ConstantComposite 30 30
463: 148(ivec2) ConstantComposite 461 461
466: 19(int) Constant 0
467: 19(int) Constant 1
468: 154(ivec2) ConstantComposite 466 466
469: 154(ivec2) ConstantComposite 467 467
541: 16(int64_t) Constant 0 0
542: 16(int64_t) Constant 1 0
543:162(i64vec2) ConstantComposite 541 541
544:162(i64vec2) ConstantComposite 542 542
547: 38(int64_t) Constant 0 0
548: 38(int64_t) Constant 1 0
549:167(i64vec2) ConstantComposite 547 547
550:167(i64vec2) ConstantComposite 548 548
556: TypeVector 77(int16_t) 3
557: TypeVector 77(int16_t) 4
558: TypeVector 91(int16_t) 3
559: TypeVector 91(int16_t) 4
560: TypeVector 29(int) 3
561: TypeVector 29(int) 4
562: TypeVector 19(int) 3
563: TypeVector 19(int) 4
564(Block): TypeStruct 77(int16_t) 139(i16vec2) 556(i16vec3) 557(i16vec4) 91(int16_t) 145(i16vec2) 558(i16vec3) 559(i16vec4) 29(int) 148(ivec2) 560(ivec3) 561(ivec4) 19(int) 154(ivec2) 562(ivec3) 563(ivec4)
565: TypePointer Uniform 564(Block)
566(block): 565(ptr) Variable Uniform
4(main): 2 Function None 3
5: Label
Return
@ -649,10 +649,10 @@ spv.explicittypes.frag
399(f64v): 194(ptr) Variable Function
406(i8v): 135(ptr) Variable Function
412(i16v): 140(ptr) Variable Function
429(u8v): 132(ptr) Variable Function
435(u16v): 221(ptr) Variable Function
452(f16v): 182(ptr) Variable Function
465(bv): 251(ptr) Variable Function
426(u8v): 132(ptr) Variable Function
432(u16v): 221(ptr) Variable Function
446(f16v): 182(ptr) Variable Function
459(bv): 251(ptr) Variable Function
382: 148(ivec2) Load 381(i32v)
383: 154(ivec2) Bitcast 382
Store 380(u32v) 383
@ -697,186 +697,177 @@ spv.explicittypes.frag
417:139(i16vec2) Bitcast 416
Store 412(i16v) 417
418: 148(ivec2) Load 381(i32v)
419: 29(int) CompositeExtract 418 0
420: 29(int) CompositeExtract 418 1
421: 148(ivec2) CompositeConstruct 419 420
Store 381(i32v) 421
422: 154(ivec2) Load 380(u32v)
423: 148(ivec2) Bitcast 422
Store 381(i32v) 423
424: 148(ivec2) Load 381(i32v)
425:162(i64vec2) SConvert 424
Store 381(i32v) 418
419: 154(ivec2) Load 380(u32v)
420: 148(ivec2) Bitcast 419
Store 381(i32v) 420
421: 148(ivec2) Load 381(i32v)
422:162(i64vec2) SConvert 421
Store 384(i64v) 422
423: 154(ivec2) Load 380(u32v)
424:167(i64vec2) UConvert 423
425:162(i64vec2) Bitcast 424
Store 384(i64v) 425
426: 154(ivec2) Load 380(u32v)
427:167(i64vec2) UConvert 426
428:162(i64vec2) Bitcast 427
Store 384(i64v) 428
430: 148(ivec2) Load 381(i32v)
431: 134(i8vec2) SConvert 430
432: 131(i8vec2) Bitcast 431
Store 429(u8v) 432
433: 154(ivec2) Load 380(u32v)
434: 131(i8vec2) UConvert 433
Store 429(u8v) 434
436: 148(ivec2) Load 381(i32v)
437:139(i16vec2) SConvert 436
438:145(i16vec2) Bitcast 437
Store 435(u16v) 438
439: 154(ivec2) Load 380(u32v)
440:145(i16vec2) UConvert 439
Store 435(u16v) 440
427: 148(ivec2) Load 381(i32v)
428: 134(i8vec2) SConvert 427
429: 131(i8vec2) Bitcast 428
Store 426(u8v) 429
430: 154(ivec2) Load 380(u32v)
431: 131(i8vec2) UConvert 430
Store 426(u8v) 431
433: 148(ivec2) Load 381(i32v)
434:139(i16vec2) SConvert 433
435:145(i16vec2) Bitcast 434
Store 432(u16v) 435
436: 154(ivec2) Load 380(u32v)
437:145(i16vec2) UConvert 436
Store 432(u16v) 437
438: 148(ivec2) Load 381(i32v)
439: 154(ivec2) Bitcast 438
Store 380(u32v) 439
440: 154(ivec2) Load 380(u32v)
Store 380(u32v) 440
441: 148(ivec2) Load 381(i32v)
442: 154(ivec2) Bitcast 441
Store 380(u32v) 442
443: 154(ivec2) Load 380(u32v)
444: 19(int) CompositeExtract 443 0
445: 19(int) CompositeExtract 443 1
446: 154(ivec2) CompositeConstruct 444 445
Store 380(u32v) 446
442:162(i64vec2) SConvert 441
443:167(i64vec2) Bitcast 442
Store 387(u64v) 443
444: 154(ivec2) Load 380(u32v)
445:167(i64vec2) UConvert 444
Store 387(u64v) 445
447: 148(ivec2) Load 381(i32v)
448:162(i64vec2) SConvert 447
449:167(i64vec2) Bitcast 448
Store 387(u64v) 449
450: 154(ivec2) Load 380(u32v)
451:167(i64vec2) UConvert 450
Store 387(u64v) 451
453: 148(ivec2) Load 381(i32v)
454:181(f16vec2) ConvertSToF 453
Store 452(f16v) 454
455: 148(ivec2) Load 381(i32v)
456: 187(fvec2) ConvertSToF 455
448:181(f16vec2) ConvertSToF 447
Store 446(f16v) 448
449: 148(ivec2) Load 381(i32v)
450: 187(fvec2) ConvertSToF 449
Store 396(f32v) 450
451: 148(ivec2) Load 381(i32v)
452:193(f64vec2) ConvertSToF 451
Store 399(f64v) 452
453: 154(ivec2) Load 380(u32v)
454:181(f16vec2) ConvertUToF 453
Store 446(f16v) 454
455: 154(ivec2) Load 380(u32v)
456: 187(fvec2) ConvertUToF 455
Store 396(f32v) 456
457: 148(ivec2) Load 381(i32v)
458:193(f64vec2) ConvertSToF 457
457: 154(ivec2) Load 380(u32v)
458:193(f64vec2) ConvertUToF 457
Store 399(f64v) 458
459: 154(ivec2) Load 380(u32v)
460:181(f16vec2) ConvertUToF 459
Store 452(f16v) 460
461: 154(ivec2) Load 380(u32v)
462: 187(fvec2) ConvertUToF 461
Store 396(f32v) 462
463: 154(ivec2) Load 380(u32v)
464:193(f64vec2) ConvertUToF 463
Store 399(f64v) 464
466: 250(bvec2) Load 465(bv)
470: 148(ivec2) Select 466 469 468
Store 381(i32v) 470
471: 250(bvec2) Load 465(bv)
476: 154(ivec2) Select 471 475 474
Store 380(u32v) 476
477: 148(ivec2) Load 381(i32v)
478: 250(bvec2) INotEqual 477 474
Store 465(bv) 478
479: 154(ivec2) Load 380(u32v)
480: 250(bvec2) INotEqual 479 474
Store 465(bv) 480
460: 250(bvec2) Load 459(bv)
464: 148(ivec2) Select 460 463 462
Store 381(i32v) 464
465: 250(bvec2) Load 459(bv)
470: 154(ivec2) Select 465 469 468
Store 380(u32v) 470
471: 148(ivec2) Load 381(i32v)
472: 250(bvec2) INotEqual 471 468
Store 459(bv) 472
473: 154(ivec2) Load 380(u32v)
474: 250(bvec2) INotEqual 473 468
Store 459(bv) 474
Return
FunctionEnd
14(typeCast64(): 2 Function None 3
15: Label
481(u64v): 168(ptr) Variable Function
482(i64v): 163(ptr) Variable Function
485(f64v): 194(ptr) Variable Function
490(i8v): 135(ptr) Variable Function
496(i16v): 140(ptr) Variable Function
502(i32v): 149(ptr) Variable Function
510(u8v): 132(ptr) Variable Function
516(u16v): 221(ptr) Variable Function
522(u32v): 157(ptr) Variable Function
534(f16v): 182(ptr) Variable Function
537(f32v): 188(ptr) Variable Function
548(bv): 251(ptr) Variable Function
483:162(i64vec2) Load 482(i64v)
484:167(i64vec2) Bitcast 483
Store 481(u64v) 484
486:162(i64vec2) Load 482(i64v)
487:193(f64vec2) ConvertSToF 486
Store 485(f64v) 487
488:167(i64vec2) Load 481(u64v)
489:193(f64vec2) ConvertUToF 488
Store 485(f64v) 489
491:162(i64vec2) Load 482(i64v)
492: 134(i8vec2) SConvert 491
Store 490(i8v) 492
493:167(i64vec2) Load 481(u64v)
494: 131(i8vec2) UConvert 493
495: 134(i8vec2) Bitcast 494
Store 490(i8v) 495
497:162(i64vec2) Load 482(i64v)
498:139(i16vec2) SConvert 497
Store 496(i16v) 498
499:167(i64vec2) Load 481(u64v)
500:145(i16vec2) UConvert 499
501:139(i16vec2) Bitcast 500
Store 496(i16v) 501
503:162(i64vec2) Load 482(i64v)
504: 148(ivec2) SConvert 503
Store 502(i32v) 504
505:167(i64vec2) Load 481(u64v)
506: 154(ivec2) UConvert 505
507: 148(ivec2) Bitcast 506
Store 502(i32v) 507
508:167(i64vec2) Load 481(u64v)
509:162(i64vec2) Bitcast 508
Store 482(i64v) 509
511:162(i64vec2) Load 482(i64v)
512: 134(i8vec2) SConvert 511
513: 131(i8vec2) Bitcast 512
Store 510(u8v) 513
514:167(i64vec2) Load 481(u64v)
515: 131(i8vec2) UConvert 514
Store 510(u8v) 515
517:162(i64vec2) Load 482(i64v)
518:139(i16vec2) SConvert 517
519:145(i16vec2) Bitcast 518
Store 516(u16v) 519
520:167(i64vec2) Load 481(u64v)
521:145(i16vec2) UConvert 520
Store 516(u16v) 521
523:162(i64vec2) Load 482(i64v)
524: 148(ivec2) SConvert 523
525: 154(ivec2) Bitcast 524
Store 522(u32v) 525
526:167(i64vec2) Load 481(u64v)
527: 154(ivec2) UConvert 526
Store 522(u32v) 527
528:162(i64vec2) Load 482(i64v)
529:167(i64vec2) Bitcast 528
Store 481(u64v) 529
530:167(i64vec2) Load 481(u64v)
531: 38(int64_t) CompositeExtract 530 0
532: 38(int64_t) CompositeExtract 530 1
533:167(i64vec2) CompositeConstruct 531 532
Store 481(u64v) 533
535:162(i64vec2) Load 482(i64v)
536:181(f16vec2) ConvertSToF 535
Store 534(f16v) 536
538:162(i64vec2) Load 482(i64v)
539: 187(fvec2) ConvertSToF 538
Store 537(f32v) 539
540:162(i64vec2) Load 482(i64v)
541:193(f64vec2) ConvertSToF 540
Store 485(f64v) 541
542:167(i64vec2) Load 481(u64v)
543:181(f16vec2) ConvertUToF 542
Store 534(f16v) 543
544:167(i64vec2) Load 481(u64v)
545: 187(fvec2) ConvertUToF 544
Store 537(f32v) 545
546:167(i64vec2) Load 481(u64v)
547:193(f64vec2) ConvertUToF 546
Store 485(f64v) 547
549: 250(bvec2) Load 548(bv)
554:162(i64vec2) Select 549 553 552
Store 482(i64v) 554
555: 250(bvec2) Load 548(bv)
560:167(i64vec2) Select 555 559 558
Store 481(u64v) 560
561:162(i64vec2) Load 482(i64v)
562: 250(bvec2) INotEqual 561 558
Store 548(bv) 562
563:167(i64vec2) Load 481(u64v)
564: 250(bvec2) INotEqual 563 558
Store 548(bv) 564
475(u64v): 168(ptr) Variable Function
476(i64v): 163(ptr) Variable Function
479(f64v): 194(ptr) Variable Function
484(i8v): 135(ptr) Variable Function
490(i16v): 140(ptr) Variable Function
496(i32v): 149(ptr) Variable Function
504(u8v): 132(ptr) Variable Function
510(u16v): 221(ptr) Variable Function
516(u32v): 157(ptr) Variable Function
525(f16v): 182(ptr) Variable Function
528(f32v): 188(ptr) Variable Function
539(bv): 251(ptr) Variable Function
477:162(i64vec2) Load 476(i64v)
478:167(i64vec2) Bitcast 477
Store 475(u64v) 478
480:162(i64vec2) Load 476(i64v)
481:193(f64vec2) ConvertSToF 480
Store 479(f64v) 481
482:167(i64vec2) Load 475(u64v)
483:193(f64vec2) ConvertUToF 482
Store 479(f64v) 483
485:162(i64vec2) Load 476(i64v)
486: 134(i8vec2) SConvert 485
Store 484(i8v) 486
487:167(i64vec2) Load 475(u64v)
488: 131(i8vec2) UConvert 487
489: 134(i8vec2) Bitcast 488
Store 484(i8v) 489
491:162(i64vec2) Load 476(i64v)
492:139(i16vec2) SConvert 491
Store 490(i16v) 492
493:167(i64vec2) Load 475(u64v)
494:145(i16vec2) UConvert 493
495:139(i16vec2) Bitcast 494
Store 490(i16v) 495
497:162(i64vec2) Load 476(i64v)
498: 148(ivec2) SConvert 497
Store 496(i32v) 498
499:167(i64vec2) Load 475(u64v)
500: 154(ivec2) UConvert 499
501: 148(ivec2) Bitcast 500
Store 496(i32v) 501
502:167(i64vec2) Load 475(u64v)
503:162(i64vec2) Bitcast 502
Store 476(i64v) 503
505:162(i64vec2) Load 476(i64v)
506: 134(i8vec2) SConvert 505
507: 131(i8vec2) Bitcast 506
Store 504(u8v) 507
508:167(i64vec2) Load 475(u64v)
509: 131(i8vec2) UConvert 508
Store 504(u8v) 509
511:162(i64vec2) Load 476(i64v)
512:139(i16vec2) SConvert 511
513:145(i16vec2) Bitcast 512
Store 510(u16v) 513
514:167(i64vec2) Load 475(u64v)
515:145(i16vec2) UConvert 514
Store 510(u16v) 515
517:162(i64vec2) Load 476(i64v)
518: 148(ivec2) SConvert 517
519: 154(ivec2) Bitcast 518
Store 516(u32v) 519
520:167(i64vec2) Load 475(u64v)
521: 154(ivec2) UConvert 520
Store 516(u32v) 521
522:162(i64vec2) Load 476(i64v)
523:167(i64vec2) Bitcast 522
Store 475(u64v) 523
524:167(i64vec2) Load 475(u64v)
Store 475(u64v) 524
526:162(i64vec2) Load 476(i64v)
527:181(f16vec2) ConvertSToF 526
Store 525(f16v) 527
529:162(i64vec2) Load 476(i64v)
530: 187(fvec2) ConvertSToF 529
Store 528(f32v) 530
531:162(i64vec2) Load 476(i64v)
532:193(f64vec2) ConvertSToF 531
Store 479(f64v) 532
533:167(i64vec2) Load 475(u64v)
534:181(f16vec2) ConvertUToF 533
Store 525(f16v) 534
535:167(i64vec2) Load 475(u64v)
536: 187(fvec2) ConvertUToF 535
Store 528(f32v) 536
537:167(i64vec2) Load 475(u64v)
538:193(f64vec2) ConvertUToF 537
Store 479(f64v) 538
540: 250(bvec2) Load 539(bv)
545:162(i64vec2) Select 540 544 543
Store 476(i64v) 545
546: 250(bvec2) Load 539(bv)
551:167(i64vec2) Select 546 550 549
Store 475(u64v) 551
552:162(i64vec2) Load 476(i64v)
553: 250(bvec2) INotEqual 552 549
Store 539(bv) 553
554:167(i64vec2) Load 475(u64v)
555: 250(bvec2) INotEqual 554 549
Store 539(bv) 555
Return
FunctionEnd