Merge pull request #1557 from nicebyte/spec-const-decorations

Add names for composite spec constants in SPIR-V
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 3d732d4..632a217 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -7292,18 +7292,19 @@
     // An AST node labelled as specialization constant should be a symbol node.
     // Its initializer should either be a sub tree with constant nodes, or a constant union array.
     if (auto* sn = node.getAsSymbolNode()) {
+        spv::Id result;
         if (auto* sub_tree = sn->getConstSubtree()) {
             // Traverse the constant constructor sub tree like generating normal run-time instructions.
             // During the AST traversal, if the node is marked as 'specConstant', SpecConstantOpModeGuard
             // will set the builder into spec constant op instruction generating mode.
             sub_tree->traverse(this);
-            return accessChainLoad(sub_tree->getType());
-        } else if (auto* const_union_array = &sn->getConstArray()){
+            result = accessChainLoad(sub_tree->getType());
+        } else if (auto* const_union_array = &sn->getConstArray()) {
             int nextConst = 0;
-            spv::Id id = createSpvConstantFromConstUnionArray(sn->getType(), *const_union_array, nextConst, true);
-            builder.addName(id, sn->getName().c_str());
-            return id;
+            result = createSpvConstantFromConstUnionArray(sn->getType(), *const_union_array, nextConst, true);
         }
+        builder.addName(result, sn->getName().c_str());
+        return result;
     }
 
     // Neither a front-end constant node, nor a specialization constant node with constant union array or
diff --git a/Test/baseResults/spv.float16.frag.out b/Test/baseResults/spv.float16.frag.out
index b9ca339..37c6639 100644
--- a/Test/baseResults/spv.float16.frag.out
+++ b/Test/baseResults/spv.float16.frag.out
@@ -114,6 +114,10 @@
                               Name 526  "sf16"
                               Name 527  "sf"
                               Name 528  "sd"
+                              Name 529  "f16_to_f"
+                              Name 531  "f16_to_d"
+                              Name 532  "f_to_f16"
+                              Name 533  "d_to_f16"
                               Decorate 512 ArrayStride 16
                               Decorate 513 ArrayStride 32
                               MemberDecorate 514(S) 0 Offset 0
@@ -235,11 +239,11 @@
        526(sf16):28(float16_t) SpecConstant 12288
          527(sf):  164(float) SpecConstant 1048576000
          528(sd):172(float64_t) SpecConstant 0 1071644672
-             529:  164(float) SpecConstantOp 115 526(sf16)
+   529(f16_to_f):  164(float) SpecConstantOp 115 526(sf16)
              530:  164(float) SpecConstantOp 115 526(sf16)
-             531:172(float64_t) SpecConstantOp 115 530
-             532:28(float16_t) SpecConstantOp 115 527(sf)
-             533:28(float16_t) SpecConstantOp 115 528(sd)
+   531(f16_to_d):172(float64_t) SpecConstantOp 115 530
+   532(f_to_f16):28(float16_t) SpecConstantOp 115 527(sf)
+   533(d_to_f16):28(float16_t) SpecConstantOp 115 528(sd)
          4(main):           2 Function None 3
                5:             Label
                               Return
diff --git a/Test/baseResults/spv.float32.frag.out b/Test/baseResults/spv.float32.frag.out
index 9ee7d7f..1a325ea 100644
--- a/Test/baseResults/spv.float32.frag.out
+++ b/Test/baseResults/spv.float32.frag.out
@@ -104,6 +104,10 @@
                               Name 525  "sf16"
                               Name 526  "sf"
                               Name 527  "sd"
+                              Name 528  "f16_to_f"
+                              Name 530  "f16_to_d"
+                              Name 531  "f_to_f16"
+                              Name 532  "d_to_f16"
                               Decorate 518 ArrayStride 16
                               Decorate 519 ArrayStride 32
                               MemberDecorate 520(S) 0 Offset 0
@@ -209,11 +213,11 @@
        525(sf16):172(float16_t) SpecConstant 12288
          526(sf):   26(float) SpecConstant 1048576000
          527(sd):149(float64_t) SpecConstant 0 1071644672
-             528:   26(float) SpecConstantOp 115 525(sf16)
+   528(f16_to_f):   26(float) SpecConstantOp 115 525(sf16)
              529:   26(float) SpecConstantOp 115 525(sf16)
-             530:149(float64_t) SpecConstantOp 115 529
-             531:172(float16_t) SpecConstantOp 115 526(sf)
-             532:172(float16_t) SpecConstantOp 115 527(sd)
+   530(f16_to_d):149(float64_t) SpecConstantOp 115 529
+   531(f_to_f16):172(float16_t) SpecConstantOp 115 526(sf)
+   532(d_to_f16):172(float16_t) SpecConstantOp 115 527(sd)
          4(main):           2 Function None 3
                5:             Label
                               Return
diff --git a/Test/baseResults/spv.float64.frag.out b/Test/baseResults/spv.float64.frag.out
index 3f095c1..78dca75 100644
--- a/Test/baseResults/spv.float64.frag.out
+++ b/Test/baseResults/spv.float64.frag.out
@@ -103,6 +103,10 @@
                               Name 515  "sf16"
                               Name 517  "sf"
                               Name 518  "sd"
+                              Name 519  "f16_to_f"
+                              Name 521  "f16_to_d"
+                              Name 522  "f_to_f16"
+                              Name 523  "d_to_f16"
                               Decorate 461(if64v) Flat
                               Decorate 508 ArrayStride 16
                               Decorate 509 ArrayStride 64
@@ -207,11 +211,11 @@
              516:             TypeFloat 32
          517(sf):  516(float) SpecConstant 1048576000
          518(sd):26(float64_t) SpecConstant 0 1071644672
-             519:  516(float) SpecConstantOp 115 515(sf16)
+   519(f16_to_f):  516(float) SpecConstantOp 115 515(sf16)
              520:  516(float) SpecConstantOp 115 515(sf16)
-             521:26(float64_t) SpecConstantOp 115 520
-             522:162(float16_t) SpecConstantOp 115 517(sf)
-             523:162(float16_t) SpecConstantOp 115 518(sd)
+   521(f16_to_d):26(float64_t) SpecConstantOp 115 520
+   522(f_to_f16):162(float16_t) SpecConstantOp 115 517(sf)
+   523(d_to_f16):162(float16_t) SpecConstantOp 115 518(sd)
          4(main):           2 Function None 3
                5:             Label
                               Return
diff --git a/Test/baseResults/spv.int16.amd.frag.out b/Test/baseResults/spv.int16.amd.frag.out
index 526373b..0e3323b 100644
--- a/Test/baseResults/spv.int16.amd.frag.out
+++ b/Test/baseResults/spv.int16.amd.frag.out
@@ -76,6 +76,28 @@
                               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"
                               MemberDecorate 25(Uniforms) 0 Offset 0
                               Decorate 25(Uniforms) Block
                               Decorate 27 DescriptorSet 0
@@ -195,37 +217,37 @@
          526(sb):   125(bool) SpecConstantTrue
        527(si16): 17(int16_t) SpecConstant 4294967291
        528(su16): 14(int16_t) SpecConstant 4
-             529:   125(bool) SpecConstantOp 171 527(si16) 202
-             530:   125(bool) SpecConstantOp 171 528(su16) 202
-             531: 17(int16_t) SpecConstantOp 169 526(sb) 53 194
-             532: 14(int16_t) SpecConstantOp 169 526(sb) 203 202
-             533:     28(int) SpecConstantOp 114 527(si16)
+   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:     28(int) SpecConstantOp 128 534 128
-             536: 17(int16_t) SpecConstantOp 114 524(si)
+   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: 14(int16_t) SpecConstantOp 128 537 202
+   538(i_to_u16): 14(int16_t) SpecConstantOp 128 537 202
              539:     28(int) SpecConstantOp 114 527(si16)
-             540:     18(int) SpecConstantOp 128 539 128
-             541:     18(int) SpecConstantOp 113 528(su16)
+   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: 17(int16_t) SpecConstantOp 128 542 202
-             544: 14(int16_t) SpecConstantOp 113 525(su)
-             545:273(int64_t) SpecConstantOp 114 527(si16)
+   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:273(int64_t) SpecConstantOp 128 546 547
-             549: 17(int16_t) SpecConstantOp 114 522(si64)
+ 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: 14(int16_t) SpecConstantOp 128 550 202
+ 551(i64_to_u16): 14(int16_t) SpecConstantOp 128 550 202
              552:273(int64_t) SpecConstantOp 114 527(si16)
-             553:285(int64_t) SpecConstantOp 128 552 547
-             554:285(int64_t) SpecConstantOp 113 528(su16)
+ 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: 17(int16_t) SpecConstantOp 128 555 202
-             557: 14(int16_t) SpecConstantOp 113 523(su64)
-             558: 14(int16_t) SpecConstantOp 128 527(si16) 202
-             559: 17(int16_t) SpecConstantOp 128 528(su16) 202
+ 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
          4(main):           2 Function None 3
                5:             Label
              511:           2 FunctionCall 6(literal()
diff --git a/Test/baseResults/spv.int64.frag.out b/Test/baseResults/spv.int64.frag.out
index b82cfa3..f2c54f1 100644
--- a/Test/baseResults/spv.int64.frag.out
+++ b/Test/baseResults/spv.int64.frag.out
@@ -1,7 +1,11 @@
 spv.int64.frag
+error: SPIRV-Tools Validation Errors
+error: OpDecorate SpecId decoration target <id> '1' is not a scalar specialization constant.
+  OpDecorate %su64inc SpecId 105
+
 // Module Version 10000
 // Generated by (magic number): 80007
-// Id's are bound by 488
+// Id's are bound by 489
 
                               Capability Shader
                               Capability Float64
@@ -55,6 +59,21 @@
                               Name 467  "si"
                               Name 468  "su"
                               Name 469  "sb"
+                              Name 470  "su64inc"
+                              Name 471  "i64_to_b"
+                              Name 472  "u64_to_b"
+                              Name 473  "b_to_i64"
+                              Name 474  "b_to_u64"
+                              Name 475  "i64_to_i"
+                              Name 476  "i_to_i64"
+                              Name 477  "u64_to_u"
+                              Name 478  "u_to_u64"
+                              Name 479  "u64_to_i64"
+                              Name 480  "i64_to_u64"
+                              Name 482  "u64_to_i"
+                              Name 484  "i_to_u64"
+                              Name 486  "i64_to_u"
+                              Name 488  "u_to_i64"
                               MemberDecorate 28(Uniforms) 0 Offset 0
                               Decorate 28(Uniforms) Block
                               Decorate 30 DescriptorSet 0
@@ -69,6 +88,7 @@
                               Decorate 467(si) SpecId 102
                               Decorate 468(su) SpecId 103
                               Decorate 469(sb) SpecId 104
+                              Decorate 470(su64inc) SpecId 105
                2:             TypeVoid
                3:             TypeFunction 2
               14:             TypeInt 64 0
@@ -157,24 +177,25 @@
          467(si):     31(int) SpecConstant 4294967291
          468(su):     21(int) SpecConstant 4
          469(sb):    55(bool) SpecConstantTrue
-             470:    55(bool) SpecConstantOp 171 465(si64) 69
-             471:    55(bool) SpecConstantOp 171 466(su64) 69
-             472: 18(int64_t) SpecConstantOp 169 469(sb) 61 60
-             473: 14(int64_t) SpecConstantOp 169 469(sb) 70 69
-             474:     31(int) SpecConstantOp 114 465(si64)
-             475: 18(int64_t) SpecConstantOp 114 467(si)
-             476:     21(int) SpecConstantOp 113 466(su64)
-             477: 14(int64_t) SpecConstantOp 113 468(su)
-             478: 18(int64_t) SpecConstantOp 128 466(su64) 69
-             479: 14(int64_t) SpecConstantOp 128 465(si64) 69
-             480:     21(int) SpecConstantOp 113 466(su64)
-             481:     31(int) SpecConstantOp 128 480 227
-             482: 18(int64_t) SpecConstantOp 114 467(si)
-             483: 14(int64_t) SpecConstantOp 128 482 69
-             484:     31(int) SpecConstantOp 114 465(si64)
-             485:     21(int) SpecConstantOp 128 484 227
-             486: 14(int64_t) SpecConstantOp 113 468(su)
-             487: 18(int64_t) SpecConstantOp 128 486 69
+    470(su64inc): 14(int64_t) SpecConstantOp 128 466(su64) 70
+   471(i64_to_b):    55(bool) SpecConstantOp 171 465(si64) 69
+   472(u64_to_b):    55(bool) SpecConstantOp 171 466(su64) 69
+   473(b_to_i64): 18(int64_t) SpecConstantOp 169 469(sb) 61 60
+   474(b_to_u64): 14(int64_t) SpecConstantOp 169 469(sb) 70 69
+   475(i64_to_i):     31(int) SpecConstantOp 114 465(si64)
+   476(i_to_i64): 18(int64_t) SpecConstantOp 114 467(si)
+   477(u64_to_u):     21(int) SpecConstantOp 113 466(su64)
+   478(u_to_u64): 14(int64_t) SpecConstantOp 113 468(su)
+ 479(u64_to_i64): 18(int64_t) SpecConstantOp 128 466(su64) 69
+ 480(i64_to_u64): 14(int64_t) SpecConstantOp 128 465(si64) 69
+             481:     21(int) SpecConstantOp 113 466(su64)
+   482(u64_to_i):     31(int) SpecConstantOp 128 481 227
+             483: 18(int64_t) SpecConstantOp 114 467(si)
+   484(i_to_u64): 14(int64_t) SpecConstantOp 128 483 69
+             485:     31(int) SpecConstantOp 114 465(si64)
+   486(i64_to_u):     21(int) SpecConstantOp 128 485 227
+             487: 14(int64_t) SpecConstantOp 113 468(su)
+   488(u_to_i64): 18(int64_t) SpecConstantOp 128 487 69
          4(main):           2 Function None 3
                5:             Label
                               Store 16(u64Max) 17
diff --git a/Test/baseResults/spv.specConstantOperations.vert.out b/Test/baseResults/spv.specConstantOperations.vert.out
index 4bc948b..0f141e3 100644
--- a/Test/baseResults/spv.specConstantOperations.vert.out
+++ b/Test/baseResults/spv.specConstantOperations.vert.out
@@ -18,10 +18,68 @@
                               Name 42  "sp_uint"
                               Name 43  "sp_sint"
                               Name 45  "sp_double"
+                              Name 46  "float_from_double"
+                              Name 47  "double_from_float"
+                              Name 49  "bool_from_int"
+                              Name 50  "bool_from_uint"
+                              Name 51  "int_from_bool"
+                              Name 53  "uint_from_bool"
+                              Name 54  "sp_uint_from_sint"
+                              Name 55  "sp_sint_from_uint"
+                              Name 56  "negate_int"
+                              Name 57  "not_int"
+                              Name 58  "sp_int_add_two"
+                              Name 61  "sp_int_add_two_sub_three"
+                              Name 63  "sp_int_add_two_sub_four"
+                              Name 64  "sp_sint_mul_two"
+                              Name 66  "sp_uint_mul_two"
+                              Name 68  "sp_sint_mul_two_div_five"
+                              Name 70  "sp_uint_mul_two_div_five"
+                              Name 71  "sp_sint_rem_four"
+                              Name 73  "sp_uint_rem_four"
+                              Name 75  "sp_sint_mul_three_div_five"
+                              Name 77  "sp_sint_shift_right_arithmetic"
+                              Name 79  "sp_uint_shift_right_arithmetic"
+                              Name 80  "sp_sint_shift_left"
+                              Name 81  "sp_uint_shift_left"
+                              Name 83  "sp_sint_or_256"
+                              Name 85  "sp_uint_xor_512"
+                              Name 86  "sp_int_lt_sp_sint"
+                              Name 87  "sp_uint_equal_sp_uint"
+                              Name 88  "sp_int_gt_sp_sint"
+                              Name 91  "iv"
+                              Name 95  "uv"
+                              Name 98  "bv_from_iv"
+                              Name 99  "bv_from_uv"
+                              Name 102  "iv_from_bv"
+                              Name 104  "uv_from_bv"
+                              Name 105  "uv_from_iv"
+                              Name 106  "iv_from_uv"
+                              Name 107  "not_iv"
+                              Name 108  "negate_iv"
+                              Name 110  "iv_add_two"
+                              Name 113  "iv_add_two_sub_three"
+                              Name 115  "iv_add_two_sub_four"
+                              Name 116  "iv_mul_two"
+                              Name 118  "iv_mul_two_div_five"
+                              Name 119  "iv_rem_four"
+                              Name 121  "iv_shift_right_arithmetic"
+                              Name 122  "iv_shift_left"
+                              Name 125  "iv_or_1024"
+                              Name 128  "uv_xor_2048"
+                              Name 129  "iv_x"
+                              Name 131  "iv_yx"
+                              Name 133  "iv_zyx"
+                              Name 134  "iv_yzxw"
                               Name 135  "a"
                               Name 136  "b"
                               Name 137  "c"
                               Name 142  "ternayArray1"
+                              Name 145  "t1"
+                              Name 146  "t2"
+                              Name 148  "t3"
+                              Name 152  "t4"
+                              Name 161  "v2"
                               Decorate 19(sp_int) SpecId 201
                               Decorate 40(sp_float) SpecId 200
                               Decorate 42(sp_uint) SpecId 202
@@ -53,95 +111,95 @@
      43(sp_sint):      6(int) SpecConstant 4294967286
               44:             TypeFloat 64
    45(sp_double):44(float64_t) SpecConstant 2333366019 1074118410
-              46:   39(float) SpecConstantOp 115 45(sp_double)
-              47:44(float64_t) SpecConstantOp 115 40(sp_float)
+46(float_from_double):   39(float) SpecConstantOp 115 45(sp_double)
+47(double_from_float):44(float64_t) SpecConstantOp 115 40(sp_float)
               48:     41(int) Constant 0
-              49:    22(bool) SpecConstantOp 171 19(sp_int) 48
-              50:    22(bool) SpecConstantOp 171 42(sp_uint) 48
-              51:      6(int) SpecConstantOp 169 49 32 12
+49(bool_from_int):    22(bool) SpecConstantOp 171 19(sp_int) 48
+50(bool_from_uint):    22(bool) SpecConstantOp 171 42(sp_uint) 48
+51(int_from_bool):      6(int) SpecConstantOp 169 49(bool_from_int) 32 12
               52:     41(int) Constant 1
-              53:     41(int) SpecConstantOp 169 49 52 48
-              54:     41(int) SpecConstantOp 128 43(sp_sint) 48
-              55:      6(int) SpecConstantOp 128 42(sp_uint) 48
-              56:      6(int) SpecConstantOp 126 19(sp_int)
-              57:      6(int) SpecConstantOp 200 19(sp_int)
-              58:      6(int) SpecConstantOp 128 19(sp_int) 20
+53(uint_from_bool):     41(int) SpecConstantOp 169 49(bool_from_int) 52 48
+54(sp_uint_from_sint):     41(int) SpecConstantOp 128 43(sp_sint) 48
+55(sp_sint_from_uint):      6(int) SpecConstantOp 128 42(sp_uint) 48
+  56(negate_int):      6(int) SpecConstantOp 126 19(sp_int)
+     57(not_int):      6(int) SpecConstantOp 200 19(sp_int)
+58(sp_int_add_two):      6(int) SpecConstantOp 128 19(sp_int) 20
               59:      6(int) SpecConstantOp 128 19(sp_int) 20
               60:      6(int) Constant 3
-              61:      6(int) SpecConstantOp 130 59 60
+61(sp_int_add_two_sub_three):      6(int) SpecConstantOp 130 59 60
               62:      6(int) Constant 4
-              63:      6(int) SpecConstantOp 130 58 62
-              64:      6(int) SpecConstantOp 132 43(sp_sint) 20
+63(sp_int_add_two_sub_four):      6(int) SpecConstantOp 130 58(sp_int_add_two) 62
+64(sp_sint_mul_two):      6(int) SpecConstantOp 132 43(sp_sint) 20
               65:     41(int) Constant 2
-              66:     41(int) SpecConstantOp 132 42(sp_uint) 65
+66(sp_uint_mul_two):     41(int) SpecConstantOp 132 42(sp_uint) 65
               67:      6(int) Constant 5
-              68:      6(int) SpecConstantOp 135 64 67
+68(sp_sint_mul_two_div_five):      6(int) SpecConstantOp 135 64(sp_sint_mul_two) 67
               69:     41(int) Constant 5
-              70:     41(int) SpecConstantOp 134 66 69
-              71:      6(int) SpecConstantOp 139 43(sp_sint) 62
+70(sp_uint_mul_two_div_five):     41(int) SpecConstantOp 134 66(sp_uint_mul_two) 69
+71(sp_sint_rem_four):      6(int) SpecConstantOp 139 43(sp_sint) 62
               72:     41(int) Constant 4
-              73:     41(int) SpecConstantOp 137 42(sp_uint) 72
+73(sp_uint_rem_four):     41(int) SpecConstantOp 137 42(sp_uint) 72
               74:      6(int) SpecConstantOp 132 43(sp_sint) 60
-              75:      6(int) SpecConstantOp 135 74 67
+75(sp_sint_mul_three_div_five):      6(int) SpecConstantOp 135 74 67
               76:      6(int) Constant 10
-              77:      6(int) SpecConstantOp 195 43(sp_sint) 76
+77(sp_sint_shift_right_arithmetic):      6(int) SpecConstantOp 195 43(sp_sint) 76
               78:      6(int) Constant 20
-              79:     41(int) SpecConstantOp 194 42(sp_uint) 78
-              80:      6(int) SpecConstantOp 196 43(sp_sint) 32
-              81:     41(int) SpecConstantOp 196 42(sp_uint) 20
+79(sp_uint_shift_right_arithmetic):     41(int) SpecConstantOp 194 42(sp_uint) 78
+80(sp_sint_shift_left):      6(int) SpecConstantOp 196 43(sp_sint) 32
+81(sp_uint_shift_left):     41(int) SpecConstantOp 196 42(sp_uint) 20
               82:      6(int) Constant 256
-              83:      6(int) SpecConstantOp 197 43(sp_sint) 82
+83(sp_sint_or_256):      6(int) SpecConstantOp 197 43(sp_sint) 82
               84:     41(int) Constant 512
-              85:     41(int) SpecConstantOp 198 42(sp_uint) 84
-              86:    22(bool) SpecConstantOp 177 19(sp_int) 43(sp_sint)
-              87:    22(bool) SpecConstantOp 170 42(sp_uint) 42(sp_uint)
-              88:    22(bool) SpecConstantOp 173 19(sp_int) 43(sp_sint)
+85(sp_uint_xor_512):     41(int) SpecConstantOp 198 42(sp_uint) 84
+86(sp_int_lt_sp_sint):    22(bool) SpecConstantOp 177 19(sp_int) 43(sp_sint)
+87(sp_uint_equal_sp_uint):    22(bool) SpecConstantOp 170 42(sp_uint) 42(sp_uint)
+88(sp_int_gt_sp_sint):    22(bool) SpecConstantOp 173 19(sp_int) 43(sp_sint)
               89:      6(int) Constant 30
               90:             TypeVector 6(int) 4
-              91:   90(ivec4) SpecConstantComposite 78 89 19(sp_int) 19(sp_int)
+          91(iv):   90(ivec4) SpecConstantComposite 78 89 19(sp_int) 19(sp_int)
               92:     41(int) Constant 4294967295
               93:     41(int) Constant 4294967294
               94:             TypeVector 41(int) 4
-              95:   94(ivec4) SpecConstantComposite 42(sp_uint) 42(sp_uint) 92 93
+          95(uv):   94(ivec4) SpecConstantComposite 42(sp_uint) 42(sp_uint) 92 93
               96:             TypeVector 22(bool) 4
               97:   94(ivec4) ConstantComposite 48 48 48 48
-              98:   96(bvec4) SpecConstantOp 171 91 97
-              99:   96(bvec4) SpecConstantOp 171 95 97
+  98(bv_from_iv):   96(bvec4) SpecConstantOp 171 91(iv) 97
+  99(bv_from_uv):   96(bvec4) SpecConstantOp 171 95(uv) 97
              100:   90(ivec4) ConstantComposite 12 12 12 12
              101:   90(ivec4) ConstantComposite 32 32 32 32
-             102:   90(ivec4) SpecConstantOp 169 98 101 100
+ 102(iv_from_bv):   90(ivec4) SpecConstantOp 169 98(bv_from_iv) 101 100
              103:   94(ivec4) ConstantComposite 52 52 52 52
-             104:   94(ivec4) SpecConstantOp 169 98 103 97
-             105:   94(ivec4) SpecConstantOp 128 91 97
-             106:   90(ivec4) SpecConstantOp 128 95 97
-             107:   90(ivec4) SpecConstantOp 200 91
-             108:   90(ivec4) SpecConstantOp 126 91
+ 104(uv_from_bv):   94(ivec4) SpecConstantOp 169 98(bv_from_iv) 103 97
+ 105(uv_from_iv):   94(ivec4) SpecConstantOp 128 91(iv) 97
+ 106(iv_from_uv):   90(ivec4) SpecConstantOp 128 95(uv) 97
+     107(not_iv):   90(ivec4) SpecConstantOp 200 91(iv)
+  108(negate_iv):   90(ivec4) SpecConstantOp 126 91(iv)
              109:   90(ivec4) ConstantComposite 20 20 20 20
-             110:   90(ivec4) SpecConstantOp 128 91 109
-             111:   90(ivec4) SpecConstantOp 128 91 109
+ 110(iv_add_two):   90(ivec4) SpecConstantOp 128 91(iv) 109
+             111:   90(ivec4) SpecConstantOp 128 91(iv) 109
              112:   90(ivec4) ConstantComposite 60 60 60 60
-             113:   90(ivec4) SpecConstantOp 130 111 112
+113(iv_add_two_sub_three):   90(ivec4) SpecConstantOp 130 111 112
              114:   90(ivec4) ConstantComposite 62 62 62 62
-             115:   90(ivec4) SpecConstantOp 130 113 114
-             116:   90(ivec4) SpecConstantOp 132 91 109
+115(iv_add_two_sub_four):   90(ivec4) SpecConstantOp 130 113(iv_add_two_sub_three) 114
+ 116(iv_mul_two):   90(ivec4) SpecConstantOp 132 91(iv) 109
              117:   90(ivec4) ConstantComposite 67 67 67 67
-             118:   90(ivec4) SpecConstantOp 135 116 117
-             119:   90(ivec4) SpecConstantOp 139 91 114
+118(iv_mul_two_div_five):   90(ivec4) SpecConstantOp 135 116(iv_mul_two) 117
+119(iv_rem_four):   90(ivec4) SpecConstantOp 139 91(iv) 114
              120:   90(ivec4) ConstantComposite 76 76 76 76
-             121:   90(ivec4) SpecConstantOp 195 91 120
-             122:   90(ivec4) SpecConstantOp 196 91 109
+121(iv_shift_right_arithmetic):   90(ivec4) SpecConstantOp 195 91(iv) 120
+122(iv_shift_left):   90(ivec4) SpecConstantOp 196 91(iv) 109
              123:      6(int) Constant 1024
              124:   90(ivec4) ConstantComposite 123 123 123 123
-             125:   90(ivec4) SpecConstantOp 197 91 124
+ 125(iv_or_1024):   90(ivec4) SpecConstantOp 197 91(iv) 124
              126:     41(int) Constant 2048
              127:   94(ivec4) ConstantComposite 126 126 126 126
-             128:   94(ivec4) SpecConstantOp 198 95 127
-             129:      6(int) SpecConstantOp 81 91 0
+128(uv_xor_2048):   94(ivec4) SpecConstantOp 198 95(uv) 127
+       129(iv_x):      6(int) SpecConstantOp 81 91(iv) 0
              130:             TypeVector 6(int) 2
-             131:  130(ivec2) SpecConstantOp 79 91 91 1(GLSL.std.450) 0
+      131(iv_yx):  130(ivec2) SpecConstantOp 79 91(iv) 91(iv) 1(GLSL.std.450) 0
              132:             TypeVector 6(int) 3
-             133:  132(ivec3) SpecConstantOp 79 91 91 2 1(GLSL.std.450) 0
-             134:   90(ivec4) SpecConstantOp 79 91 91 1(GLSL.std.450) 2 0 3
+     133(iv_zyx):  132(ivec3) SpecConstantOp 79 91(iv) 91(iv) 2 1(GLSL.std.450) 0
+    134(iv_yzxw):   90(ivec4) SpecConstantOp 79 91(iv) 91(iv) 1(GLSL.std.450) 2 0 3
           135(a):      6(int) SpecConstant 4
           136(b):      6(int) SpecConstant 6
           137(c):    22(bool) SpecConstantTrue
@@ -152,14 +210,14 @@
 142(ternayArray1):    141(ptr) Variable Private
              143:      6(int) Constant 13
              144:      6(int) Constant 17
-             145:      6(int) SpecConstantOp 169 137(c) 143 144
-             146:      6(int) SpecConstantOp 169 137(c) 135(a) 144
+         145(t1):      6(int) SpecConstantOp 169 137(c) 143 144
+         146(t2):      6(int) SpecConstantOp 169 137(c) 135(a) 144
              147:    22(bool) ConstantTrue
-             148:      6(int) SpecConstantOp 169 147 135(a) 144
+         148(t3):      6(int) SpecConstantOp 169 147 135(a) 144
              149:    22(bool) SpecConstantOp 173 135(a) 136(b)
              150:      6(int) SpecConstantOp 128 143 135(a)
              151:      6(int) SpecConstantOp 132 144 136(b)
-             152:      6(int) SpecConstantOp 169 149 150 151
+         152(t4):      6(int) SpecConstantOp 169 149 150 151
              153:    22(bool) SpecConstantOp 168 137(c)
              154:             TypeVector 39(float) 2
              155:   39(float) Constant 1065353216
@@ -168,7 +226,7 @@
              158:  154(fvec2) ConstantComposite 157 157
              159:             TypeVector 22(bool) 2
              160:  159(bvec2) SpecConstantComposite 153 153
-             161:  154(fvec2) SpecConstantOp 169 160 156 158
+         161(v2):  154(fvec2) SpecConstantOp 169 160 156 158
          4(main):           2 Function None 3
                5:             Label
                               Return
diff --git a/Test/spv.int64.frag b/Test/spv.int64.frag
index 8fda12b..4ec04cd 100644
--- a/Test/spv.int64.frag
+++ b/Test/spv.int64.frag
@@ -236,6 +236,7 @@
 layout(constant_id = 102) const int  si = -5;

 layout(constant_id = 103) const uint su = 4;

 layout(constant_id = 104) const bool sb = true;

+layout(constant_id = 105) const uint64_t su64inc = su64 + 1UL;

 

 // bool <-> int64/uint64

 const bool i64_to_b = bool(si64);