Add end-to-end corpus from Tint SPIR-V Reader
Add the unit tests samples from src/reader/spirv when:
- they are valid for Vulkan 1.0 (plus some common extensions)
- they should translate to valid WGSL
Bug: tint:1043
Change-Id: I40a01990dbc40aff5cf7ace0b1aabfd0e437f638
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60000
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..3256180
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,121 @@
+; Test: ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageFetch %v4float %77 %vi12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..ac09841
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_99 = x_20.Load(int3(vi12, 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..fbafb59
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_99 = tint_symbol_1.read(uint2(vi12), 0);
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..917bf89
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %int_0 = OpConstant %int 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageFetch %v4float %47 %28 Lod %int_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..c8535c1
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec4<f32> = textureLoad(x_20, vi12, 0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..9535b67
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,121 @@
+; Test: ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageFetch %v4uint %77 %vi12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..1725be2
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<uint4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const uint4 x_99 = x_20.Load(int3(vi12, 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..0dfc657
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<uint, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ uint4 const x_99 = tint_symbol_1.read(uint2(vi12), 0);
+ return;
+}
+
+fragment void tint_symbol(texture2d<uint, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..51a3a49
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %uint = OpTypeInt 32 0
+ %6 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %int_0 = OpConstant %int 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageFetch %v4uint %47 %29 Lod %int_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..fe8fbb1
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<u32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec4<u32> = textureLoad(x_20, vi12, 0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
new file mode 100644
index 0000000..af1af6b
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
@@ -0,0 +1,121 @@
+; Test: ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageFetch %v4int %77 %vi12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..176bcdd
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<int4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const int4 x_99 = x_20.Load(int3(vi12, 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..97b86f3
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<int, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int4 const x_99 = tint_symbol_1.read(uint2(vi12), 0);
+ return;
+}
+
+fragment void tint_symbol(texture2d<int, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..2ed8afb
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %int = OpTypeInt 32 1
+ %6 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %int_0 = OpConstant %int 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageFetch %v4int %47 %28 Lod %int_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..149a246
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<i32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec4<i32> = textureLoad(x_20, vi12, 0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
new file mode 100644
index 0000000..0027fec
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
@@ -0,0 +1,119 @@
+; Test: ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 2 Rgba32f
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%74 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%75 = OpLoad %70 %10
+%76 = OpLoad %72 %20
+%99 = OpImageRead %v4float %76 %vi12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..d3c24fe
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,31 @@
+warning: use of deprecated intrinsic
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_99 = x_20.Load(int3(vi12, 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..825caa6
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
@@ -0,0 +1,31 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::read> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_99 = tint_symbol_1.read(uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..754bebf
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 2 Rgba32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageRead %v4float %47 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..412c09e
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,33 @@
+warning: use of deprecated intrinsic
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32float, read>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec4<f32> = textureLoad(x_20, vi12);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
new file mode 100644
index 0000000..cbf0f83
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
@@ -0,0 +1,119 @@
+; Test: ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%74 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%75 = OpLoad %70 %10
+%76 = OpLoad %72 %20
+%99 = OpImageRead %v4uint %76 %vi12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..8955379
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
@@ -0,0 +1,31 @@
+warning: use of deprecated intrinsic
+SamplerState x_10 : register(s0, space0);
+Texture2D<uint4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const uint4 x_99 = x_20.Load(int3(vi12, 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
new file mode 100644
index 0000000..f4ed887
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
@@ -0,0 +1,31 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<uint, access::read> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ uint4 const x_99 = tint_symbol_1.read(uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<uint, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..8d9735a
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %uint = OpTypeInt 32 0
+ %6 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageRead %v4uint %47 %29
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..502c9b1
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
@@ -0,0 +1,33 @@
+warning: use of deprecated intrinsic
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32uint, read>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec4<u32> = textureLoad(x_20, vi12);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
new file mode 100644
index 0000000..97268dd
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
@@ -0,0 +1,119 @@
+; Test: ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %int 2D 0 0 0 2 Rgba32i
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%74 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%75 = OpLoad %70 %10
+%76 = OpLoad %72 %20
+%99 = OpImageRead %v4int %76 %vi12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..2383277
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl
@@ -0,0 +1,31 @@
+warning: use of deprecated intrinsic
+SamplerState x_10 : register(s0, space0);
+Texture2D<int4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const int4 x_99 = x_20.Load(int3(vi12, 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl
new file mode 100644
index 0000000..0ffbcb3
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl
@@ -0,0 +1,31 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<int, access::read> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int4 const x_99 = tint_symbol_1.read(uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<int, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..59796e2
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %int = OpTypeInt 32 1
+ %6 = OpTypeImage %int 2D 0 0 0 2 Rgba32i
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageRead %v4int %47 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..b2035a7
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl
@@ -0,0 +1,33 @@
+warning: use of deprecated intrinsic
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32sint, read>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec4<i32> = textureLoad(x_20, vi12);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm
new file mode 100644
index 0000000..96560be
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm
@@ -0,0 +1,121 @@
+; Test: ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageSampleImplicitLod %v4float %78 %vf12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..932c9d9
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_99 = x_20.Sample(x_10, vf12);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.msl
new file mode 100644
index 0000000..4375a78
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_99 = tint_symbol_1.sample(tint_symbol_2, vf12);
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..b9b07e0
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleImplicitLod %v4float %50 %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..472823f
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec4<f32> = textureSample(x_20, x_10, vf12);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
new file mode 100644
index 0000000..73d252c
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
@@ -0,0 +1,112 @@
+; Test: ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageFetch %v4float %71 %u1
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..6357492
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Load(int2(int(u1), 0));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
new file mode 100644
index 0000000..34f26c7
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::sample> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.read(uint(int(u1)), 0);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..1848be4
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int_0 = OpConstant %int 0
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %50 = OpBitcast %int %uint_1
+ %48 = OpImageFetch %v4float %49 %50 Lod %int_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..0b67cff
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_1d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureLoad(x_20, i32(u1), 0);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
new file mode 100644
index 0000000..c020aa6
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
@@ -0,0 +1,110 @@
+; Test: ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 1D 0 0 0 2 R32f
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+%71 = OpImageRead %v4float %70 %u1
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..00b6261
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+warning: use of deprecated intrinsic
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_71 = x_20.Load(int2(int(u1), 0));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
new file mode 100644
index 0000000..dab454b
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
@@ -0,0 +1,28 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::read> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_71 = tint_symbol_1.read(uint(int(u1)));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..b47cc8e
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
@@ -0,0 +1,82 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 2 R32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %50 = OpBitcast %int %uint_1
+ %48 = OpImageRead %v4float %49 %50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..a236ae0
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
@@ -0,0 +1,30 @@
+warning: use of deprecated intrinsic
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_1d<r32float, read>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_71 : vec4<f32> = textureLoad(x_20, i32(u1));
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
new file mode 100644
index 0000000..955523e
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
@@ -0,0 +1,110 @@
+; Test: ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 1D 0 0 0 2 R32f
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+OpImageWrite %70 %u1 %vf1234
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..1a33a73
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+RWTexture1D<float4> x_20 : register(u1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ x_20[int(u1)] = vf1234;
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
new file mode 100644
index 0000000..2f05d2b
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::write> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ tint_symbol_1.write(vf1234, uint(int(u1)));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..4e465fa
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 2 R32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %50 = OpBitcast %int %uint_1
+ OpImageWrite %49 %50 %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..e4de802
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_1d<r32float, write>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ textureStore(x_20, i32(u1), vf1234);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm
new file mode 100644
index 0000000..902438e
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm
@@ -0,0 +1,112 @@
+; Test: ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageFetch %v4float %71 %vu12
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl
new file mode 100644
index 0000000..9e8165d
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.read(uint2(int2(vu12)), 0);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..76c637e
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int_0 = OpConstant %int 0
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %50 = OpBitcast %v2int %31
+ %48 = OpImageFetch %v4float %49 %50 Lod %int_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..dba1319
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureLoad(x_20, vec2<i32>(vu12), 0);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm
new file mode 100644
index 0000000..ae63ba8
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm
@@ -0,0 +1,110 @@
+; Test: ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+%71 = OpImageRead %v4float %70 %vu12
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.msl
new file mode 100644
index 0000000..6713b54
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.msl
@@ -0,0 +1,28 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::read> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_71 = tint_symbol_1.read(uint2(int2(vu12)));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..eee2570
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.spvasm
@@ -0,0 +1,81 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %50 = OpBitcast %v2int %31
+ %48 = OpImageRead %v4float %49 %50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..fbe4e1a
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.wgsl
@@ -0,0 +1,30 @@
+warning: use of deprecated intrinsic
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<r32float, read>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_71 : vec4<f32> = textureLoad(x_20, vec2<i32>(vu12));
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm
new file mode 100644
index 0000000..d329901
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm
@@ -0,0 +1,110 @@
+; Test: ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+OpImageWrite %70 %vu12 %vf1234
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..5c83a3f
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+RWTexture2D<float4> x_20 : register(u1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ x_20[int2(vu12)] = vf1234;
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.msl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.msl
new file mode 100644
index 0000000..5e32b20
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::write> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ tint_symbol_1.write(vf1234, uint2(int2(vu12)));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..263b5c4
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %50 = OpBitcast %v2int %31
+ OpImageWrite %49 %50 %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..ca42d80
--- /dev/null
+++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<r32float, write>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ textureStore(x_20, vec2<i32>(vu12), vf1234);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
new file mode 100644
index 0000000..96d39eb
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %f1
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..5d99a18
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, f1);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
new file mode 100644
index 0000000..a1ec20a
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, f1);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..15138de
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %48 = OpImageSampleImplicitLod %v4float %52 %float_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..193ebee
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_1d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, f1);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
new file mode 100644
index 0000000..2ad1ba0
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf12
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..c90be53
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, vf12.x);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
new file mode 100644
index 0000000..7f21d1c
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf12.x);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..3b16a16
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %53 = OpCompositeExtract %float %41 0
+ %48 = OpImageSampleImplicitLod %v4float %52 %53
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..ac4b620
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_1d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf12.x);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
new file mode 100644
index 0000000..1c5a80c
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf123
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..5d62d42
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, vf123.x);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
new file mode 100644
index 0000000..1f1b811
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf123.x);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..40a76be
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %53 = OpCompositeExtract %float %44 0
+ %48 = OpImageSampleImplicitLod %v4float %52 %53
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..c58533f
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_1d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf123.x);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm
new file mode 100644
index 0000000..52ba56e
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf1234
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..83a5703
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, vf1234.x);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl
new file mode 100644
index 0000000..55676da
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf1234.x);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..f6a1b00
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %53 = OpCompositeExtract %float %47 0
+ %48 = OpImageSampleImplicitLod %v4float %52 %53
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..ed286d5
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_1d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf1234.x);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
new file mode 100644
index 0000000..37c619e
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf123
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..0b1e681
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, float3(vf123.xy, float(int(vf123.z))));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
new file mode 100644
index 0000000..c35f357
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf123.xy, int(vf123.z));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..7645a19
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 64
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %53 = OpVectorShuffle %v2float %44 %44 0 1
+ %54 = OpCompositeExtract %float %53 0
+ %55 = OpCompositeExtract %float %53 1
+ %58 = OpCompositeExtract %float %44 2
+ %57 = OpConvertFToS %int %58
+ %56 = OpConvertSToF %float %57
+ %59 = OpCompositeConstruct %v3float %54 %55 %56
+ %48 = OpImageSampleImplicitLod %v4float %52 %59
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %62 = OpLabel
+ %63 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..a5f904a
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf123.xy, i32(vf123.z));
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
new file mode 100644
index 0000000..d374779
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf1234
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..054600e
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, float3(vf1234.xy, float(int(vf1234.z))));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
new file mode 100644
index 0000000..117ca8f
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf1234.xy, int(vf1234.z));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..4d5a9cb
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 64
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %53 = OpVectorShuffle %v2float %47 %47 0 1
+ %54 = OpCompositeExtract %float %53 0
+ %55 = OpCompositeExtract %float %53 1
+ %58 = OpCompositeExtract %float %47 2
+ %57 = OpConvertFToS %int %58
+ %56 = OpConvertSToF %float %57
+ %59 = OpCompositeConstruct %v3float %54 %55 %56
+ %48 = OpImageSampleImplicitLod %v4float %52 %59
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %62 = OpLabel
+ %63 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..5cb51a3
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf1234.xy, i32(vf1234.z));
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
new file mode 100644
index 0000000..264d206
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf12
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..e80450b
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, vf12);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
new file mode 100644
index 0000000..0d1252f
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf12);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..d065038
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %48 = OpImageSampleImplicitLod %v4float %52 %41
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb63d93
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf12);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
new file mode 100644
index 0000000..83839ff
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf123
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..ccd77f9
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, vf123.xy);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
new file mode 100644
index 0000000..e8e4d1f
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf123.xy);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..4164842
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %53 = OpVectorShuffle %v2float %44 %44 0 1
+ %48 = OpImageSampleImplicitLod %v4float %52 %53
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..bc7bd7b
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf123.xy);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
new file mode 100644
index 0000000..84f5f58
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf1234
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..f00cd55
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, vf1234.xy);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
new file mode 100644
index 0000000..68ee2c2
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf1234.xy);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..f290163
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %53 = OpVectorShuffle %v2float %47 %47 0 1
+ %48 = OpImageSampleImplicitLod %v4float %52 %53
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..d514b6d
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf1234.xy);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
new file mode 100644
index 0000000..e2f994d
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf123
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..86fbb4f
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture3D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, vf123);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
new file mode 100644
index 0000000..aa96b76
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture3d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf123);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture3d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..2fe350a
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %48 = OpImageSampleImplicitLod %v4float %52 %44
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..525e451
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_3d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf123);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
new file mode 100644
index 0000000..6760d0d
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf1234
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..b51bc16
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture3D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, vf1234.xyz);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
new file mode 100644
index 0000000..c199c96
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture3d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf1234.xyz);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture3d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..245318a
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %53 = OpVectorShuffle %v3float %47 %47 0 1 2
+ %48 = OpImageSampleImplicitLod %v4float %52 %53
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..309ec34
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_3d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf1234.xyz);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm b/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
new file mode 100644
index 0000000..f702b8d
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf1234
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..cf2e325
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+TextureCubeArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, float4(vf1234.xyz, float(int(vf1234.w))));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl b/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
new file mode 100644
index 0000000..e47b321
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texturecube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf1234.xyz, int(vf1234.w));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texturecube_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..5da605c
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 65
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %53 = OpVectorShuffle %v3float %47 %47 0 1 2
+ %54 = OpCompositeExtract %float %53 0
+ %55 = OpCompositeExtract %float %53 1
+ %56 = OpCompositeExtract %float %53 2
+ %59 = OpCompositeExtract %float %47 3
+ %58 = OpConvertFToS %int %59
+ %57 = OpConvertSToF %float %58
+ %60 = OpCompositeConstruct %v4float %54 %55 %56 %57
+ %48 = OpImageSampleImplicitLod %v4float %52 %60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %63 = OpLabel
+ %64 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..ab52711
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_cube_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf1234.xyz, i32(vf1234.w));
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
new file mode 100644
index 0000000..47ffffe
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf123
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..f180cc3
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+TextureCube<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, vf123);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
new file mode 100644
index 0000000..f579145
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texturecube<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf123);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texturecube<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..f087d4b
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %48 = OpImageSampleImplicitLod %v4float %52 %44
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..a850027
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_cube<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf123);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
new file mode 100644
index 0000000..08cddd0
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
@@ -0,0 +1,112 @@
+; Test: Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf1234
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..3eff801
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+TextureCube<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, vf1234.xyz);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
new file mode 100644
index 0000000..bbf88bf
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texturecube<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf1234.xyz);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texturecube<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..73ebb70
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %53 = OpVectorShuffle %v3float %47 %47 0 1 2
+ %48 = OpImageSampleImplicitLod %v4float %52 %53
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..08cbbd3
--- /dev/null
+++ b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_cube<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf1234.xyz);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..62f3a19
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+%99 = OpImageFetch %v4float %66 %vi12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..276e56d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+Texture2D x_20 : register(t1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ const float4 x_99 = float4(x_20.Load(int3(vi12, 0)).x, 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..a98a8d4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ float4 const x_99 = float4(tint_symbol_1.read(uint2(vi12), 0), 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..2da4858
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,68 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %int_0 = OpConstant %int 0
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %44 = OpLoad %3 %x_20
+ %43 = OpImageFetch %v4float %44 %23 Lod %int_0
+ %42 = OpCompositeExtract %float %43 0
+ %47 = OpCompositeConstruct %v4float %42 %float_0 %float_0 %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..fc8398c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, 0), 0.0, 0.0, 0.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..3588dc6
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+%99 = OpImageFetch %v4float %66 %vi12 Sample %u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..5552bb5
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+Texture2DMS<float4> x_20 : register(t1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ const float4 x_99 = x_20.Load(vi12, int(u1));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..ce64fab
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_ms<float, access::read> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ float4 const x_99 = tint_symbol_1.read(uint2(vi12), int(u1));
+ return;
+}
+
+fragment void tint_symbol(texture2d_ms<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..11b9e37
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,65 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ %44 = OpBitcast %int %uint_1
+ %42 = OpImageFetch %v4float %43 %23 Sample %44
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..e90b685
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_multisampled_2d<f32>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ let x_99 : vec4<f32> = textureLoad(x_20, vi12, i32(u1));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..b47cfe1
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+%99 = OpImageFetch %v4float %66 %vi12 Sample %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..12d9a7e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+Texture2DMS<float4> x_20 : register(t1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ const float4 x_99 = x_20.Load(vi12, i1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..a92b324
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_ms<float, access::read> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ float4 const x_99 = tint_symbol_1.read(uint2(vi12), i1);
+ return;
+}
+
+fragment void tint_symbol(texture2d_ms<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..14513e2
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,64 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ %42 = OpImageFetch %v4float %43 %23 Sample %int_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..099e81d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_multisampled_2d<f32>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ let x_99 : vec4<f32> = textureLoad(x_20, vi12, i1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..cc6541c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+%99 = OpImageFetch %v4float %66 %vi12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..7accfe0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+Texture2D<float4> x_20 : register(t1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ const float4 x_99 = x_20.Load(int3(vi12, 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..cadc6e9
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ float4 const x_99 = tint_symbol_1.read(uint2(vi12), 0);
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..d8c9513
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,65 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %int_0 = OpConstant %int 0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ %42 = OpImageFetch %v4float %43 %23 Lod %int_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..4510f15
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ let x_99 : vec4<f32> = textureLoad(x_20, vi12, 0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..fce9b5c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+%99 = OpImageFetch %v4float %66 %vi12 Lod %int_3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..226a19f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+Texture2D<float4> x_20 : register(t1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ const float4 x_99 = x_20.Load(int3(vi12, 3));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..6f199b5
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ float4 const x_99 = tint_symbol_1.read(uint2(vi12), 3);
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..c1bde58
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,64 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ %42 = OpImageFetch %v4float %43 %23 Lod %int_3
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..d4a286c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ let x_99 : vec4<f32> = textureLoad(x_20, vi12, 3);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm
new file mode 100644
index 0000000..26f06c1
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+%99 = OpImageFetch %v4float %66 %vi12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..276e56d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+Texture2D x_20 : register(t1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ const float4 x_99 = float4(x_20.Load(int3(vi12, 0)).x, 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..a98a8d4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ float4 const x_99 = float4(tint_symbol_1.read(uint2(vi12), 0), 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..2da4858
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,68 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %int_0 = OpConstant %int 0
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %44 = OpLoad %3 %x_20
+ %43 = OpImageFetch %v4float %44 %23 Lod %int_0
+ %42 = OpCompositeExtract %float %43 0
+ %47 = OpCompositeConstruct %v4float %42 %float_0 %float_0 %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..fc8398c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, 0), 0.0, 0.0, 0.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm
new file mode 100644
index 0000000..dc54cc5
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+%99 = OpImageFetch %v4float %66 %vi12 Lod %int_3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..7ebeb96
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+Texture2D x_20 : register(t1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ const float4 x_99 = float4(x_20.Load(int3(vi12, 3)).x, 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..276dc12
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ float4 const x_99 = float4(tint_symbol_1.read(uint2(vi12), 3), 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..3f8a1c8
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 50
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %44 = OpLoad %3 %x_20
+ %43 = OpImageFetch %v4float %44 %23 Lod %int_3
+ %42 = OpCompositeExtract %float %43 0
+ %46 = OpCompositeConstruct %v4float %42 %float_0 %float_0 %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..5f61e27
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ let x_99 : vec4<f32> = vec4<f32>(textureLoad(x_20, vi12, 3), 0.0, 0.0, 0.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..fa78144
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQueryLevels %int %77
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..a1c275b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const int x_99 = tint_tmp.z;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..8b4fb7d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int const x_99 = int(tint_symbol_1.get_num_mip_levels());
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..f4b288f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageQueryLevels %int %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..1dfacd6
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : i32 = textureNumLevels(x_20);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..5753ad5
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQueryLevels %int %77
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..c89ba14
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int4 tint_tmp;
+ x_20.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ const int x_99 = tint_tmp.w;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..3ec3e6b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int const x_99 = int(tint_symbol_1.get_num_mip_levels());
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..5dd28cb
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageQueryLevels %int %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f64f8d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : i32 = textureNumLevels(x_20);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
new file mode 100644
index 0000000..d6b93c4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQueryLevels %int %77
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..4b93bd2
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+Texture3D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int4 tint_tmp;
+ x_20.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ const int x_99 = tint_tmp.w;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..daed090
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture3d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int const x_99 = int(tint_symbol_1.get_num_mip_levels());
+ return;
+}
+
+fragment void tint_symbol(texture3d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..d42a8e9
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageQueryLevels %int %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9f0bf4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_3d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : i32 = textureNumLevels(x_20);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
new file mode 100644
index 0000000..c8d1f58
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQueryLevels %int %77
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..b6bc8de
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+TextureCube<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const int x_99 = tint_tmp.z;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..f712af0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texturecube<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int const x_99 = int(tint_symbol_1.get_num_mip_levels());
+ return;
+}
+
+fragment void tint_symbol(texturecube<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..258238e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageQueryLevels %int %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..9cd5760
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_cube<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : i32 = textureNumLevels(x_20);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
new file mode 100644
index 0000000..a717694
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQueryLevels %int %77
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..e992e81
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+TextureCubeArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int4 tint_tmp;
+ x_20.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ const int x_99 = tint_tmp.w;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
new file mode 100644
index 0000000..770b992
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texturecube_array<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int const x_99 = int(tint_symbol_1.get_num_mip_levels());
+ return;
+}
+
+fragment void tint_symbol(texturecube_array<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..e3f3f68
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageQueryLevels %int %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..99c8bf4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_cube_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : i32 = textureNumLevels(x_20);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
new file mode 100644
index 0000000..c4a7c65
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQueryLevels %int %77
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..485be37
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const int x_99 = tint_tmp.z;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl
new file mode 100644
index 0000000..d86b33e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int const x_99 = int(tint_symbol_1.get_num_mip_levels());
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..66f82b0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageQueryLevels %int %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..a059785
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : i32 = textureNumLevels(x_20);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm
new file mode 100644
index 0000000..f0dbf33
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 1 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQueryLevels %int %77
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..56fc13f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int4 tint_tmp;
+ x_20.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ const int x_99 = tint_tmp.w;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.msl
new file mode 100644
index 0000000..92dfcc7
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d_array<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int const x_99 = int(tint_symbol_1.get_num_mip_levels());
+ return;
+}
+
+fragment void tint_symbol(depth2d_array<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..23d006c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageQueryLevels %int %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..f6d61ae
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : i32 = textureNumLevels(x_20);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm
new file mode 100644
index 0000000..24589cf
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float Cube 1 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQueryLevels %int %77
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.hlsl
new file mode 100644
index 0000000..39b656f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+TextureCube x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const int x_99 = tint_tmp.z;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.msl
new file mode 100644
index 0000000..8cbb02d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depthcube<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int const x_99 = int(tint_symbol_1.get_num_mip_levels());
+ return;
+}
+
+fragment void tint_symbol(depthcube<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.spvasm
new file mode 100644
index 0000000..d9342e6
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageQueryLevels %int %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.wgsl
new file mode 100644
index 0000000..19ff8ec
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_cube;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : i32 = textureNumLevels(x_20);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm
new file mode 100644
index 0000000..c0c9a06
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float Cube 1 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQueryLevels %int %77
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.hlsl
new file mode 100644
index 0000000..27c1534
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+TextureCubeArray x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int4 tint_tmp;
+ x_20.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ const int x_99 = tint_tmp.w;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.msl
new file mode 100644
index 0000000..f459c08
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depthcube_array<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int const x_99 = int(tint_symbol_1.get_num_mip_levels());
+ return;
+}
+
+fragment void tint_symbol(depthcube_array<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.spvasm
new file mode 100644
index 0000000..a8d0d58
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 1 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageQueryLevels %int %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.wgsl
new file mode 100644
index 0000000..618b4f6
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_cube_array;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : i32 = textureNumLevels(x_20);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..2ec20cf
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQueryLevels %uint %77
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..7442848
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const uint x_99 = uint(tint_tmp.z);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..d959305
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ uint const x_99 = uint(int(tint_symbol_1.get_num_mip_levels()));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..92079d3
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQueryLevels %int %48
+ %46 = OpBitcast %uint %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..cde8eeb
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : u32 = u32(textureNumLevels(x_20));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..e9a3e5d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,119 @@
+; Test: ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%74 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%75 = OpLoad %70 %10
+%76 = OpLoad %72 %20
+%99 = OpImageQuerySamples %int %76
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..17c6a11
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DMS<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const int x_99 = tint_tmp.z;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..ceec1f6
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_ms<float, access::read> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int const x_99 = int(tint_symbol_1.get_num_samples());
+ return;
+}
+
+fragment void tint_symbol(texture2d_ms<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..7cbddbb
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %6 %x_20
+ %46 = OpImageQuerySamples %int %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..c2207de
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_multisampled_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : i32 = textureNumSamples(x_20);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..471db5d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,119 @@
+; Test: ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%74 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%75 = OpLoad %70 %10
+%76 = OpLoad %72 %20
+%99 = OpImageQuerySamples %uint %76
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..d0fc2f3
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DMS<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const uint x_99 = uint(tint_tmp.z);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..7ebdb4a
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_ms<float, access::read> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ uint const x_99 = uint(int(tint_symbol_1.get_num_samples()));
+ return;
+}
+
+fragment void tint_symbol(texture2d_ms<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..67ed2b5
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySamples %int %48
+ %46 = OpBitcast %uint %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..03f824f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_multisampled_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : u32 = u32(textureNumSamples(x_20));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..1ca187a
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQuerySizeLod %v3int %77 %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..737b06b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,34 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int4 tint_tmp;
+ x_20.GetDimensions(i1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int3 tint_tmp_1;
+ x_20.GetDimensions(tint_tmp_1.x, tint_tmp_1.y, tint_tmp_1.z);
+ const int3 x_99 = int3(tint_tmp.xy, tint_tmp_1.z);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..a995870
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int3 const x_99 = int3(int2(tint_symbol_1.get_width(i1), tint_symbol_1.get_height(i1)), int(tint_symbol_1.get_array_size()));
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..f1cc99f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %int_0 = OpConstant %int 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySizeLod %v3int %48 %int_1
+ %46 = OpVectorShuffle %v2int %47 %47 0 1
+ %49 = OpCompositeExtract %int %46 0
+ %50 = OpCompositeExtract %int %46 1
+ %53 = OpLoad %6 %x_20
+ %52 = OpImageQuerySizeLod %v3int %53 %int_0
+ %51 = OpCompositeExtract %int %52 2
+ %55 = OpCompositeConstruct %v3int %49 %50 %51
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..7b57d9a
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20, i1), textureNumLayers(x_20));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..962f677
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQuerySizeLod %v3int %77 %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..7b21f26
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,34 @@
+SamplerState x_10 : register(s0, space0);
+TextureCubeArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int4 tint_tmp;
+ x_20.GetDimensions(i1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int3 tint_tmp_1;
+ x_20.GetDimensions(tint_tmp_1.x, tint_tmp_1.y, tint_tmp_1.z);
+ const int3 x_99 = int3(tint_tmp.xy.xy, tint_tmp_1.z);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..765ed45
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texturecube_array<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int3 const x_99 = int3(int2(tint_symbol_1.get_width(i1), tint_symbol_1.get_height(i1)).xy, int(tint_symbol_1.get_array_size()));
+ return;
+}
+
+fragment void tint_symbol(texturecube_array<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..e3febe5
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 60
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %int_0 = OpConstant %int 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySizeLod %v3int %48 %int_1
+ %46 = OpVectorShuffle %v2int %47 %47 0 1
+ %49 = OpVectorShuffle %v2int %46 %46 0 1
+ %50 = OpCompositeExtract %int %49 0
+ %51 = OpCompositeExtract %int %49 1
+ %54 = OpLoad %6 %x_20
+ %53 = OpImageQuerySizeLod %v3int %54 %int_0
+ %52 = OpCompositeExtract %int %53 2
+ %56 = OpCompositeConstruct %v3int %50 %51 %52
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..497b830
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_cube_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20, i1).xy, textureNumLayers(x_20));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
new file mode 100644
index 0000000..aa933a4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 1 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQuerySizeLod %v3int %77 %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..3192658
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,34 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int4 tint_tmp;
+ x_20.GetDimensions(i1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int3 tint_tmp_1;
+ x_20.GetDimensions(tint_tmp_1.x, tint_tmp_1.y, tint_tmp_1.z);
+ const int3 x_99 = int3(tint_tmp.xy, tint_tmp_1.z);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..7fc9142
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d_array<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int3 const x_99 = int3(int2(tint_symbol_1.get_width(i1), tint_symbol_1.get_height(i1)), int(tint_symbol_1.get_array_size()));
+ return;
+}
+
+fragment void tint_symbol(depth2d_array<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..feffb2f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %int_0 = OpConstant %int 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySizeLod %v3int %48 %int_1
+ %46 = OpVectorShuffle %v2int %47 %47 0 1
+ %49 = OpCompositeExtract %int %46 0
+ %50 = OpCompositeExtract %int %46 1
+ %53 = OpLoad %6 %x_20
+ %52 = OpImageQuerySizeLod %v3int %53 %int_0
+ %51 = OpCompositeExtract %int %52 2
+ %55 = OpCompositeConstruct %v3int %49 %50 %51
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..362eee8
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20, i1), textureNumLayers(x_20));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
new file mode 100644
index 0000000..2c5e1c9
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float Cube 1 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQuerySizeLod %v3int %77 %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..78f2dd8
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,34 @@
+SamplerState x_10 : register(s0, space0);
+TextureCubeArray x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int4 tint_tmp;
+ x_20.GetDimensions(i1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int3 tint_tmp_1;
+ x_20.GetDimensions(tint_tmp_1.x, tint_tmp_1.y, tint_tmp_1.z);
+ const int3 x_99 = int3(tint_tmp.xy.xy, tint_tmp_1.z);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..3134431
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depthcube_array<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int3 const x_99 = int3(int2(tint_symbol_1.get_width(i1), tint_symbol_1.get_height(i1)).xy, int(tint_symbol_1.get_array_size()));
+ return;
+}
+
+fragment void tint_symbol(depthcube_array<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..cc25919
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 60
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 1 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %int_0 = OpConstant %int 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySizeLod %v3int %48 %int_1
+ %46 = OpVectorShuffle %v2int %47 %47 0 1
+ %49 = OpVectorShuffle %v2int %46 %46 0 1
+ %50 = OpCompositeExtract %int %49 0
+ %51 = OpCompositeExtract %int %49 1
+ %54 = OpLoad %6 %x_20
+ %53 = OpImageQuerySizeLod %v3int %54 %int_0
+ %52 = OpCompositeExtract %int %53 2
+ %56 = OpCompositeConstruct %v3int %50 %51 %52
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..84671ed
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_cube_array;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20, i1).xy, textureNumLayers(x_20));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..3fed4a4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQuerySizeLod %v2int %77 %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..615507a
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(i1, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const int2 x_99 = int2(tint_tmp.xy);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..005045c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int2 const x_99 = int2(int2(tint_symbol_1.get_width(i1), tint_symbol_1.get_height(i1)));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..3c1a645
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySizeLod %v2int %48 %int_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..01f8917
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec2<i32> = vec2<i32>(textureDimensions(x_20, i1));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
new file mode 100644
index 0000000..5b5cadb
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQuerySizeLod %v3int %77 %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..a36cb04
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+Texture3D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int4 tint_tmp;
+ x_20.GetDimensions(i1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ const int3 x_99 = int3(tint_tmp.xyz);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..29d396e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture3d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int3 const x_99 = int3(int3(tint_symbol_1.get_width(i1), tint_symbol_1.get_height(i1), tint_symbol_1.get_depth(i1)));
+ return;
+}
+
+fragment void tint_symbol(texture3d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..375680d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySizeLod %v3int %48 %int_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..cc23ec1
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_3d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20, i1));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
new file mode 100644
index 0000000..666141d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQuerySizeLod %v2int %77 %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..416f283
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+TextureCube<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(i1, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const int2 x_99 = int2(tint_tmp.xy.xy);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..0332d0e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texturecube<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int2 const x_99 = int2(int2(tint_symbol_1.get_width(i1), tint_symbol_1.get_height(i1)).xy);
+ return;
+}
+
+fragment void tint_symbol(texturecube<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..44bbb99
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 53
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySizeLod %v2int %48 %int_1
+ %49 = OpVectorShuffle %v2int %47 %47 0 1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..0aac2b1
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_cube<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec2<i32> = vec2<i32>(textureDimensions(x_20, i1).xy);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
new file mode 100644
index 0000000..58d36ec
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQuerySizeLod %v2int %77 %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..0272d4e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(i1, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const int2 x_99 = int2(tint_tmp.xy);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
new file mode 100644
index 0000000..a050d72
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int2 const x_99 = int2(int2(tint_symbol_1.get_width(i1), tint_symbol_1.get_height(i1)));
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..dcb0fa8
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySizeLod %v2int %48 %int_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..57e9d2f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec2<i32> = vec2<i32>(textureDimensions(x_20, i1));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
new file mode 100644
index 0000000..fadedb0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float Cube 1 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%99 = OpImageQuerySizeLod %v2int %77 %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..45f9b9b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+TextureCube x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(i1, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const int2 x_99 = int2(tint_tmp.xy.xy);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl
new file mode 100644
index 0000000..121a49e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depthcube<float, access::sample> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int2 const x_99 = int2(int2(tint_symbol_1.get_width(i1), tint_symbol_1.get_height(i1)).xy);
+ return;
+}
+
+fragment void tint_symbol(depthcube<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..cd2eb75
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 53
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySizeLod %v2int %48 %int_1
+ %49 = OpVectorShuffle %v2int %47 %47 0 1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..7234972
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_cube;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec2<i32> = vec2<i32>(textureDimensions(x_20, i1).xy);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..5e81a58
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,120 @@
+; Test: ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 2 Rgba32f
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%74 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%75 = OpLoad %70 %10
+%76 = OpLoad %72 %20
+%99 = OpImageQuerySize %v3int %76
+%98 = OpImageRead %v4float %76 %vi123
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..c9fdb6a
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,32 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::read> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int3 const x_99 = int3(int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()), int(tint_symbol_1.get_array_size()));
+ float4 const x_98 = tint_symbol_1.read(uint2(vi123.xy), vi123.z);
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..0503340
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,91 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 65
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 2 Rgba32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySize %v3int %48
+ %46 = OpVectorShuffle %v2int %47 %47 0 1
+ %49 = OpCompositeExtract %int %46 0
+ %50 = OpCompositeExtract %int %46 1
+ %53 = OpLoad %6 %x_20
+ %52 = OpImageQuerySize %v3int %53
+ %51 = OpCompositeExtract %int %52 2
+ %54 = OpCompositeConstruct %v3int %49 %50 %51
+ %56 = OpLoad %6 %x_20
+ %57 = OpVectorShuffle %v2int %31 %31 0 1
+ %58 = OpCompositeExtract %int %57 0
+ %59 = OpCompositeExtract %int %57 1
+ %60 = OpCompositeExtract %int %31 2
+ %61 = OpCompositeConstruct %v3int %58 %59 %60
+ %55 = OpImageRead %v4float %56 %61
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %63 = OpLabel
+ %64 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..bbdc71f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_Arrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,34 @@
+warning: use of deprecated intrinsic
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_2d_array<rgba32float, read>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20), textureNumLayers(x_20));
+ let x_98 : vec4<f32> = textureLoad(x_20, vi123.xy, vi123.z);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..e18febb
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,120 @@
+; Test: ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 2 Rgba32f
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%74 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%75 = OpLoad %70 %10
+%76 = OpLoad %72 %20
+%99 = OpImageQuerySize %v2int %76
+%98 = OpImageRead %v4float %76 %vi12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..00208b9
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,34 @@
+warning: use of deprecated intrinsic
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int2 tint_tmp;
+ x_20.GetDimensions(tint_tmp.x, tint_tmp.y);
+ const int2 x_99 = int2(tint_tmp);
+ const float4 x_98 = x_20.Load(int3(vi12, 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..fb31616
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,32 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::read> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int2 const x_99 = int2(int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()));
+ float4 const x_98 = tint_symbol_1.read(uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..b156c3e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,79 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 2 Rgba32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySize %v2int %48
+ %50 = OpLoad %6 %x_20
+ %49 = OpImageRead %v4float %50 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..66757c0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,34 @@
+warning: use of deprecated intrinsic
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32float, read>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec2<i32> = vec2<i32>(textureDimensions(x_20));
+ let x_98 : vec4<f32> = textureLoad(x_20, vi12);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
new file mode 100644
index 0000000..810f0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
@@ -0,0 +1,120 @@
+; Test: ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 3D 0 0 0 2 Rgba32f
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%74 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%75 = OpLoad %70 %10
+%76 = OpLoad %72 %20
+%99 = OpImageQuerySize %v3int %76
+%98 = OpImageRead %v4float %76 %vi123
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..8583b1b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,34 @@
+warning: use of deprecated intrinsic
+SamplerState x_10 : register(s0, space0);
+Texture3D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const int3 x_99 = int3(tint_tmp);
+ const float4 x_98 = x_20.Load(int4(vi123, 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..32d32d1
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
@@ -0,0 +1,32 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture3d<float, access::read> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int3 const x_99 = int3(int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth()));
+ float4 const x_98 = tint_symbol_1.read(uint3(vi123));
+ return;
+}
+
+fragment void tint_symbol(texture3d<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..6595822
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,79 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 3D 0 0 0 2 Rgba32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySize %v3int %48
+ %50 = OpLoad %6 %x_20
+ %49 = OpImageRead %v4float %50 %31
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..022852a
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,34 @@
+warning: use of deprecated intrinsic
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_3d<rgba32float, read>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec3<i32> = vec3<i32>(textureDimensions(x_20));
+ let x_98 : vec4<f32> = textureLoad(x_20, vi123);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
new file mode 100644
index 0000000..73eadc3
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
@@ -0,0 +1,119 @@
+; Test: ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%74 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%75 = OpLoad %70 %10
+%76 = OpLoad %72 %20
+%99 = OpImageQuerySize %v2int %76
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..34d7716
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DMS<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ int3 tint_tmp;
+ x_20.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const int2 x_99 = int2(tint_tmp.xy);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..e20cacf
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_ms<float, access::read> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ int2 const x_99 = int2(int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()));
+ return;
+}
+
+fragment void tint_symbol(texture2d_ms<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..a6fe6f9
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %6 %x_20
+ %47 = OpImageQuerySize %v2int %48
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..b6eed29
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_multisampled_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_99 : vec2<i32> = vec2<i32>(textureDimensions(x_20));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..845156e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 100
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 0 2 Rgba32f
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+%99 = OpImageRead %v4float %66 %vi12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..b6074fd
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,25 @@
+warning: use of deprecated intrinsic
+Texture2D<float4> x_20 : register(t1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ const float4 x_99 = x_20.Load(int3(vi12, 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..eb5b6ad1
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,27 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::read> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ float4 const x_99 = tint_symbol_1.read(uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..0590182
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,66 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 2 Rgba32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ %42 = OpImageRead %v4float %43 %23
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..ee058ef
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageRead_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+warning: use of deprecated intrinsic
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32float, read>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ let x_99 : vec4<f32> = textureLoad(x_20, vi12);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..c10993d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleDrefExplicitLod %float %78 %coords12 %float_0_200000003 Lod %float_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..29f4734
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerComparisonState x_10 : register(s0, space0);
+Texture2D x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float x_79 = x_20.SampleCmpLevelZero(x_10, vf12, 0.200000003f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..9487c30
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float const x_79 = tint_symbol_1.sample_compare(tint_symbol_2, coords12, 0.200000003f, level(0));
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..dcb7022
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %40 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %46 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %50 = OpTypeSampledImage %6
+%float_0_200000003 = OpConstant %float 0.200000003
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %48 = OpLoad %3 %x_10
+ %49 = OpLoad %6 %x_20
+ %51 = OpSampledImage %50 %49 %48
+ %47 = OpImageSampleDrefExplicitLod %float %51 %17 %float_0_200000003 Lod %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..dc05282
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : f32 = textureSampleCompareLevel(x_20, x_10, coords12, 0.200000003);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..0d263c0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 1 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleDrefExplicitLod %float %78 %coords123 %float_0_200000003 Lod %float_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..0db5d67
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerComparisonState x_10 : register(s0, space0);
+Texture2DArray x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float x_79 = x_20.SampleCmpLevelZero(x_10, float3(coords123.xy, float(int(coords123.z))), 0.200000003f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..a4ef480
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float const x_79 = tint_symbol_1.sample_compare(tint_symbol_2, coords123.xy, int(coords123.z), 0.200000003f, level(0));
+ return;
+}
+
+fragment void tint_symbol(depth2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..c907c32
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 64
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %40 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %46 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %50 = OpTypeSampledImage %6
+%float_0_200000003 = OpConstant %float 0.200000003
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %48 = OpLoad %3 %x_10
+ %49 = OpLoad %6 %x_20
+ %51 = OpSampledImage %50 %49 %48
+ %52 = OpVectorShuffle %v2float %21 %21 0 1
+ %53 = OpCompositeExtract %float %52 0
+ %54 = OpCompositeExtract %float %52 1
+ %57 = OpCompositeExtract %float %21 2
+ %56 = OpConvertFToS %int %57
+ %55 = OpConvertSToF %float %56
+ %58 = OpCompositeConstruct %v3float %53 %54 %55
+ %47 = OpImageSampleDrefExplicitLod %float %51 %58 %float_0_200000003 Lod %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %62 = OpLabel
+ %63 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..3042bf3
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : f32 = textureSampleCompareLevel(x_20, x_10, coords123.xy, i32(coords123.z), 0.200000003);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
new file mode 100644
index 0000000..21d4029
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleDrefExplicitLod %float %78 %coords12 %float_0_200000003 Lod|ConstOffset %float_0 %offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..aaea7f7
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerComparisonState x_10 : register(s0, space0);
+Texture2D x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float x_79 = x_20.SampleCmpLevelZero(x_10, vf12, 0.200000003f, int2(3, 4));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..fb6d7d4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float const x_79 = tint_symbol_1.sample_compare(tint_symbol_2, coords12, 0.200000003f, level(0), int2(3, 4));
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..14b94d7
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %40 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %46 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %50 = OpTypeSampledImage %6
+%float_0_200000003 = OpConstant %float 0.200000003
+ %float_0 = OpConstant %float 0
+ %54 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %48 = OpLoad %3 %x_10
+ %49 = OpLoad %6 %x_20
+ %51 = OpSampledImage %50 %49 %48
+ %47 = OpImageSampleDrefExplicitLod %float %51 %17 %float_0_200000003 Lod|ConstOffset %float_0 %54
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..1fede99
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : f32 = textureSampleCompareLevel(x_20, x_10, coords12, 0.200000003, vec2<i32>(3, 4));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
new file mode 100644
index 0000000..2b3eb99
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 1 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleDrefExplicitLod %float %78 %coords123 %float_0_200000003 Lod|ConstOffset %float_0 %offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..5231fc8
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerComparisonState x_10 : register(s0, space0);
+Texture2DArray x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float x_79 = x_20.SampleCmpLevelZero(x_10, float3(coords123.xy, float(int(coords123.z))), 0.200000003f, int2(3, 4));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..3093834
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float const x_79 = tint_symbol_1.sample_compare(tint_symbol_2, coords123.xy, int(coords123.z), 0.200000003f, level(0), int2(3, 4));
+ return;
+}
+
+fragment void tint_symbol(depth2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..1a27bc0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 65
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %40 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %46 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %50 = OpTypeSampledImage %6
+%float_0_200000003 = OpConstant %float 0.200000003
+ %float_0 = OpConstant %float 0
+ %61 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %48 = OpLoad %3 %x_10
+ %49 = OpLoad %6 %x_20
+ %51 = OpSampledImage %50 %49 %48
+ %52 = OpVectorShuffle %v2float %21 %21 0 1
+ %53 = OpCompositeExtract %float %52 0
+ %54 = OpCompositeExtract %float %52 1
+ %57 = OpCompositeExtract %float %21 2
+ %56 = OpConvertFToS %int %57
+ %55 = OpConvertSToF %float %56
+ %58 = OpCompositeConstruct %v3float %53 %54 %55
+ %47 = OpImageSampleDrefExplicitLod %float %51 %58 %float_0_200000003 Lod|ConstOffset %float_0 %61
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %63 = OpLabel
+ %64 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..b01094d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : f32 = textureSampleCompareLevel(x_20, x_10, coords123.xy, i32(coords123.z), 0.200000003, vec2<i32>(3, 4));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
new file mode 100644
index 0000000..523fe16
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float Cube 1 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleDrefExplicitLod %float %78 %coords123 %float_0_200000003 Lod %float_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..1d68927
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerComparisonState x_10 : register(s0, space0);
+TextureCube x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float4 coords1234 = vf1234;
+ const float x_79 = x_20.SampleCmpLevelZero(x_10, vf123, 0.200000003f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
new file mode 100644
index 0000000..13f98de
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depthcube<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float const x_79 = tint_symbol_1.sample_compare(tint_symbol_2, coords123, 0.200000003f, level(0));
+ return;
+}
+
+fragment void tint_symbol(depthcube<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..addf940
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %40 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %46 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %50 = OpTypeSampledImage %6
+%float_0_200000003 = OpConstant %float 0.200000003
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %48 = OpLoad %3 %x_10
+ %49 = OpLoad %6 %x_20
+ %51 = OpSampledImage %50 %49 %48
+ %47 = OpImageSampleDrefExplicitLod %float %51 %21 %float_0_200000003 Lod %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..6422976
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_cube;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : f32 = textureSampleCompareLevel(x_20, x_10, coords123, 0.200000003);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
new file mode 100644
index 0000000..7e86647
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float Cube 1 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleDrefExplicitLod %float %78 %coords1234 %float_0_200000003 Lod %float_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..7dc9c5f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerComparisonState x_10 : register(s0, space0);
+TextureCubeArray x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float x_79 = x_20.SampleCmpLevelZero(x_10, float4(coords1234.xyz, float(int(coords1234.w))), 0.200000003f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl
new file mode 100644
index 0000000..ba834c3
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depthcube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float const x_79 = tint_symbol_1.sample_compare(tint_symbol_2, coords1234.xyz, int(coords1234.w), 0.200000003f, level(0));
+ return;
+}
+
+fragment void tint_symbol(depthcube_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..af5c4f0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 65
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float Cube 1 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %40 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %46 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %50 = OpTypeSampledImage %6
+%float_0_200000003 = OpConstant %float 0.200000003
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %48 = OpLoad %3 %x_10
+ %49 = OpLoad %6 %x_20
+ %51 = OpSampledImage %50 %49 %48
+ %52 = OpVectorShuffle %v3float %24 %24 0 1 2
+ %53 = OpCompositeExtract %float %52 0
+ %54 = OpCompositeExtract %float %52 1
+ %55 = OpCompositeExtract %float %52 2
+ %58 = OpCompositeExtract %float %24 3
+ %57 = OpConvertFToS %int %58
+ %56 = OpConvertSToF %float %57
+ %59 = OpCompositeConstruct %v4float %53 %54 %55 %56
+ %47 = OpImageSampleDrefExplicitLod %float %51 %59 %float_0_200000003 Lod %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %63 = OpLabel
+ %64 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..7ca37e7
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_cube_array;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : f32 = textureSampleCompareLevel(x_20, x_10, coords1234.xyz, i32(coords1234.w), 0.200000003);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..5681efc
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleDrefImplicitLod %float %78 %coords12 %float_0_200000003
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..9a7cc2e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerComparisonState x_10 : register(s0, space0);
+Texture2D x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float x_79 = x_20.SampleCmp(x_10, vf12, 0.200000003f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..7e9fdfc
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float const x_79 = tint_symbol_1.sample_compare(tint_symbol_2, coords12, 0.200000003f);
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..0279112
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %40 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %46 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %50 = OpTypeSampledImage %6
+%float_0_200000003 = OpConstant %float 0.200000003
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %48 = OpLoad %3 %x_10
+ %49 = OpLoad %6 %x_20
+ %51 = OpSampledImage %50 %49 %48
+ %47 = OpImageSampleDrefImplicitLod %float %51 %17 %float_0_200000003
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..a49497f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : f32 = textureSampleCompare(x_20, x_10, coords12, 0.200000003);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..ba70409
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleDrefImplicitLod %float %78 %coords123 %float_0_200000003
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..4ce5274
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerComparisonState x_10 : register(s0, space0);
+Texture2DArray x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float x_79 = x_20.SampleCmp(x_10, float3(coords123.xy, float(int(coords123.z))), 0.200000003f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..b3acb6a
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float const x_79 = tint_symbol_1.sample_compare(tint_symbol_2, coords123.xy, int(coords123.z), 0.200000003f);
+ return;
+}
+
+fragment void tint_symbol(depth2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..add70aa
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,86 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 63
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %40 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %46 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %50 = OpTypeSampledImage %6
+%float_0_200000003 = OpConstant %float 0.200000003
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %48 = OpLoad %3 %x_10
+ %49 = OpLoad %6 %x_20
+ %51 = OpSampledImage %50 %49 %48
+ %52 = OpVectorShuffle %v2float %21 %21 0 1
+ %53 = OpCompositeExtract %float %52 0
+ %54 = OpCompositeExtract %float %52 1
+ %57 = OpCompositeExtract %float %21 2
+ %56 = OpConvertFToS %int %57
+ %55 = OpConvertSToF %float %56
+ %58 = OpCompositeConstruct %v3float %53 %54 %55
+ %47 = OpImageSampleDrefImplicitLod %float %51 %58 %float_0_200000003
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %61 = OpLabel
+ %62 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f4560d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : f32 = textureSampleCompare(x_20, x_10, coords123.xy, i32(coords123.z), 0.200000003);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
new file mode 100644
index 0000000..1c19751
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleDrefImplicitLod %float %78 %coords12 %float_0_200000003 ConstOffset %offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..4c3c3d9
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerComparisonState x_10 : register(s0, space0);
+Texture2D x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float x_79 = x_20.SampleCmp(x_10, vf12, 0.200000003f, int2(3, 4));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..33a83c2
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float const x_79 = tint_symbol_1.sample_compare(tint_symbol_2, coords12, 0.200000003f, int2(3, 4));
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..7e97a13
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %40 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %46 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %50 = OpTypeSampledImage %6
+%float_0_200000003 = OpConstant %float 0.200000003
+ %53 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %48 = OpLoad %3 %x_10
+ %49 = OpLoad %6 %x_20
+ %51 = OpSampledImage %50 %49 %48
+ %47 = OpImageSampleDrefImplicitLod %float %51 %17 %float_0_200000003 ConstOffset %53
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..6b39dae
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : f32 = textureSampleCompare(x_20, x_10, coords12, 0.200000003, vec2<i32>(3, 4));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
new file mode 100644
index 0000000..27d2402
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleDrefImplicitLod %float %78 %coords123 %float_0_200000003 ConstOffset %offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..f325185
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerComparisonState x_10 : register(s0, space0);
+Texture2DArray x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float x_79 = x_20.SampleCmp(x_10, float3(coords123.xy, float(int(coords123.z))), 0.200000003f, int2(3, 4));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..8e79610
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float const x_79 = tint_symbol_1.sample_compare(tint_symbol_2, coords123.xy, int(coords123.z), 0.200000003f, int2(3, 4));
+ return;
+}
+
+fragment void tint_symbol(depth2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..17489b5
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 64
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %40 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %46 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %50 = OpTypeSampledImage %6
+%float_0_200000003 = OpConstant %float 0.200000003
+ %60 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %48 = OpLoad %3 %x_10
+ %49 = OpLoad %6 %x_20
+ %51 = OpSampledImage %50 %49 %48
+ %52 = OpVectorShuffle %v2float %21 %21 0 1
+ %53 = OpCompositeExtract %float %52 0
+ %54 = OpCompositeExtract %float %52 1
+ %57 = OpCompositeExtract %float %21 2
+ %56 = OpConvertFToS %int %57
+ %55 = OpConvertSToF %float %56
+ %58 = OpCompositeConstruct %v3float %53 %54 %55
+ %47 = OpImageSampleDrefImplicitLod %float %51 %58 %float_0_200000003 ConstOffset %60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %62 = OpLabel
+ %63 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..276e633
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : f32 = textureSampleCompare(x_20, x_10, coords123.xy, i32(coords123.z), 0.200000003, vec2<i32>(3, 4));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..0907d72
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %vf12 Lod %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..a7a3154
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleLevel(x_10, vf12, f1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..f55dae5
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, vf12, level(f1));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..327ff1e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleExplicitLod %v4float %50 %16 Lod %float_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..aadaa4e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleLevel(x_20, x_10, vf12, f1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..703decb
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %vf12 Lod %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..925e26a
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = float4(x_20.SampleLevel(x_10, vf12, int(f1)).x, 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..2f7ff19
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = float4(tint_symbol_1.sample(tint_symbol_2, vf12, level(int(f1))), 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..be082bb
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %50 = OpTypeSampledImage %6
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %48 = OpLoad %3 %x_10
+ %49 = OpLoad %6 %x_20
+ %51 = OpSampledImage %50 %49 %48
+ %53 = OpConvertFToS %int %float_1
+ %52 = OpConvertSToF %float %53
+ %47 = OpImageSampleExplicitLod %v4float %51 %16 Lod %52
+ %46 = OpCompositeExtract %float %47 0
+ %55 = OpCompositeConstruct %v4float %46 %float_0 %float_0 %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..090941d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = vec4<f32>(textureSampleLevel(x_20, x_10, vf12, i32(f1)), 0.0, 0.0, 0.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..ab0ddac
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %coords12 Grad %vf12 %vf21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..9c6e504
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleGrad(x_10, vf12, vf12, vf21);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..fcc5379
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords12, gradient2d(vf12, vf21));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..67236c7
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleExplicitLod %v4float %50 %16 Grad %16 %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..fd8a7a6
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleGrad(x_20, x_10, coords12, vf12, vf21);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..6968656
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %coords123 Grad %vf12 %vf21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..b09b8df
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleGrad(x_10, float3(coords123.xy, float(int(coords123.z))), vf12, vf21);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..12a08ef
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords123.xy, int(coords123.z), gradient2d(vf12, vf21));
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..29ee7b8
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 61
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %51 = OpVectorShuffle %v2float %20 %20 0 1
+ %52 = OpCompositeExtract %float %51 0
+ %53 = OpCompositeExtract %float %51 1
+ %56 = OpCompositeExtract %float %20 2
+ %55 = OpConvertFToS %int %56
+ %54 = OpConvertSToF %float %55
+ %57 = OpCompositeConstruct %v3float %52 %53 %54
+ %46 = OpImageSampleExplicitLod %v4float %50 %57 Grad %16 %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %59 = OpLabel
+ %60 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..9df3616
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleGrad(x_20, x_10, coords123.xy, i32(coords123.z), vf12, vf21);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
new file mode 100644
index 0000000..827d766
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %coords12 Grad|ConstOffset %vf12 %vf21 %offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..9c0f1cc
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleGrad(x_10, vf12, vf12, vf21, int2(3, 4));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..aa58df7
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords12, gradient2d(vf12, vf21), int2(3, 4));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..83e52c9
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %51 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleExplicitLod %v4float %50 %16 Grad|ConstOffset %16 %17 %51
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..3f066bd
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleGrad(x_20, x_10, coords12, vf12, vf21, vec2<i32>(3, 4));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
new file mode 100644
index 0000000..5d3f091
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %coords12 Grad|ConstOffset %vf12 %vf21 %u_offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..d232f37
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleGrad(x_10, vf12, vf12, vf21, int2(uint2(3u, 4u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..7525579
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords12, gradient2d(vf12, vf21), int2(uint2(3u, 4u)));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..8d831c6
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %51 = OpConstantComposite %v2int %int_3 %int_3
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleExplicitLod %v4float %50 %16 Grad|ConstOffset %16 %17 %51
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..ce99bde
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleGrad(x_20, x_10, coords12, vf12, vf21, vec2<i32>(vec2<u32>(3u, 4u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
new file mode 100644
index 0000000..644f39c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %coords123 Grad|ConstOffset %vf12 %vf21 %offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..449647a
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleGrad(x_10, float3(coords123.xy, float(int(coords123.z))), vf12, vf21, int2(3, 4));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
new file mode 100644
index 0000000..404f86e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords123.xy, int(coords123.z), gradient2d(vf12, vf21), int2(3, 4));
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..d873c84
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 62
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %58 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %51 = OpVectorShuffle %v2float %20 %20 0 1
+ %52 = OpCompositeExtract %float %51 0
+ %53 = OpCompositeExtract %float %51 1
+ %56 = OpCompositeExtract %float %20 2
+ %55 = OpConvertFToS %int %56
+ %54 = OpConvertSToF %float %55
+ %57 = OpCompositeConstruct %v3float %52 %53 %54
+ %46 = OpImageSampleExplicitLod %v4float %50 %57 Grad|ConstOffset %16 %17 %58
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %60 = OpLabel
+ %61 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..36779e2
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleGrad(x_20, x_10, coords123.xy, i32(coords123.z), vf12, vf21, vec2<i32>(3, 4));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
new file mode 100644
index 0000000..f087b2c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %coords123 Grad|ConstOffset %vf12 %vf21 %u_offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..76c0cd0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleGrad(x_10, float3(coords123.xy, float(int(coords123.z))), vf12, vf21, int2(uint2(3u, 4u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl
new file mode 100644
index 0000000..b7919d3
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords123.xy, int(coords123.z), gradient2d(vf12, vf21), int2(uint2(3u, 4u)));
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..7635bff
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 62
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %58 = OpConstantComposite %v2int %int_3 %int_3
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %51 = OpVectorShuffle %v2float %20 %20 0 1
+ %52 = OpCompositeExtract %float %51 0
+ %53 = OpCompositeExtract %float %51 1
+ %56 = OpCompositeExtract %float %20 2
+ %55 = OpConvertFToS %int %56
+ %54 = OpConvertSToF %float %55
+ %57 = OpCompositeConstruct %v3float %52 %53 %54
+ %46 = OpImageSampleExplicitLod %v4float %50 %57 Grad|ConstOffset %16 %17 %58
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %60 = OpLabel
+ %61 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..af81b04
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleGrad(x_20, x_10, coords123.xy, i32(coords123.z), vf12, vf21, vec2<i32>(vec2<u32>(3u, 4u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..a8a0f1b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %coords12 Lod %49
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..d5db37c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleLevel(x_10, vf12, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..ac80cfb
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords12, level(0.0f));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..e6f3413
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleExplicitLod %v4float %50 %16 Lod %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..59fd0f3
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleLevel(x_20, x_10, coords12, 0.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..7d3f992
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %coords123 Lod %49
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..79643f4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleLevel(x_10, float3(coords123.xy, float(int(coords123.z))), 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..818bb02
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords123.xy, int(coords123.z), level(0.0f));
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..cc09c3e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 62
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %51 = OpVectorShuffle %v2float %20 %20 0 1
+ %52 = OpCompositeExtract %float %51 0
+ %53 = OpCompositeExtract %float %51 1
+ %56 = OpCompositeExtract %float %20 2
+ %55 = OpConvertFToS %int %56
+ %54 = OpConvertSToF %float %55
+ %57 = OpCompositeConstruct %v3float %52 %53 %54
+ %46 = OpImageSampleExplicitLod %v4float %50 %57 Lod %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %60 = OpLabel
+ %61 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..3ce4005
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleLevel(x_20, x_10, coords123.xy, i32(coords123.z), 0.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
new file mode 100644
index 0000000..30d4866
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %coords12 Lod|ConstOffset %49 %offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..e6113c9
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleLevel(x_10, vf12, 0.0f, int2(3, 4));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..c2b4e58
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords12, level(0.0f), int2(3, 4));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..8f50fc6
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %float_0 = OpConstant %float 0
+ %52 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleExplicitLod %v4float %50 %16 Lod|ConstOffset %float_0 %52
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..7865423
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleLevel(x_20, x_10, coords12, 0.0, vec2<i32>(3, 4));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
new file mode 100644
index 0000000..6704c59
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %coords12 Lod|ConstOffset %49 %u_offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..cb37d6f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleLevel(x_10, vf12, 0.0f, int2(uint2(3u, 4u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..95d1681
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords12, level(0.0f), int2(uint2(3u, 4u)));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..ab036fd
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %float_0 = OpConstant %float 0
+ %52 = OpConstantComposite %v2int %int_3 %int_3
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleExplicitLod %v4float %50 %16 Lod|ConstOffset %float_0 %52
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..4bb18fa
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleLevel(x_20, x_10, coords12, 0.0, vec2<i32>(vec2<u32>(3u, 4u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
new file mode 100644
index 0000000..8ff6f59
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleExplicitLod %v4float %78 %coords123 Lod|ConstOffset %49 %offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..4981065
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleLevel(x_10, float3(coords123.xy, float(int(coords123.z))), 0.0f, int2(3, 4));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
new file mode 100644
index 0000000..63d9173
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords123.xy, int(coords123.z), level(0.0f), int2(3, 4));
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..c6caa9b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
@@ -0,0 +1,86 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 63
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %float_0 = OpConstant %float 0
+ %59 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %51 = OpVectorShuffle %v2float %20 %20 0 1
+ %52 = OpCompositeExtract %float %51 0
+ %53 = OpCompositeExtract %float %51 1
+ %56 = OpCompositeExtract %float %20 2
+ %55 = OpConvertFToS %int %56
+ %54 = OpConvertSToF %float %55
+ %57 = OpCompositeConstruct %v3float %52 %53 %54
+ %46 = OpImageSampleExplicitLod %v4float %50 %57 Lod|ConstOffset %float_0 %59
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %61 = OpLabel
+ %62 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..54de1ae
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleLevel(x_20, x_10, coords123.xy, i32(coords123.z), 0.0, vec2<i32>(3, 4));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..18143fa
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,124 @@
+; Test: ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 211
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpLoad %70 %30
+%80 = OpSampledImage %74 %77 %79
+%200 = OpImageSampleImplicitLod %v4float %78 %coords12
+%210 = OpImageSampleDrefImplicitLod %float %80 %coords12 %float_0_200000003
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..c43b5da
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,31 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D x_20 : register(t1, space2);
+SamplerComparisonState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_200 = float4(x_20.Sample(x_10, coords12).x, 0.0f, 0.0f, 0.0f);
+ const float x_210 = x_20.SampleCmp(x_30, coords12, 0.200000003f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..7a45724
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,31 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2, sampler tint_symbol_3) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_200 = float4(tint_symbol_1.sample(tint_symbol_2, coords12), 0.0f, 0.0f, 0.0f);
+ float const x_210 = tint_symbol_1.sample_compare(tint_symbol_3, coords12, 0.200000003f);
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_4 [[texture(1)]], sampler tint_symbol_5 [[sampler(0)]], sampler tint_symbol_6 [[sampler(1)]]) {
+ main_1(tint_symbol_4, tint_symbol_5, tint_symbol_6);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..95e31fb
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,86 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 63
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %17 = OpConstantComposite %v2float %float_1 %float_2
+ %18 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %21 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %24 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %29 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %32 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %35 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %40 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %46 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %51 = OpTypeSampledImage %6
+ %float_0 = OpConstant %float 0
+%float_0_200000003 = OpConstant %float 0.200000003
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %48 = OpImageSampleImplicitLod %v4float %52 %17
+ %47 = OpCompositeExtract %float %48 0
+ %54 = OpCompositeConstruct %v4float %47 %float_0 %float_0 %float_0
+ %56 = OpLoad %3 %x_30
+ %57 = OpLoad %6 %x_20
+ %58 = OpSampledImage %51 %57 %56
+ %55 = OpImageSampleDrefImplicitLod %float %58 %17 %float_0_200000003
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %61 = OpLabel
+ %62 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..58da158
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,33 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+
+[[group(0), binding(1)]] var x_30 : sampler_comparison;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_200 : vec4<f32> = vec4<f32>(textureSample(x_20, x_10, coords12), 0.0, 0.0, 0.0);
+ let x_210 : f32 = textureSampleCompare(x_20, x_30, coords12, 0.200000003);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..5636069
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleImplicitLod %v4float %78 %coords12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..e940f29
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.Sample(x_10, vf12);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..948a899
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords12);
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..b9b07e0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleImplicitLod %v4float %50 %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..6be7f3c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSample(x_20, x_10, coords12);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..c664e99
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleImplicitLod %v4float %78 %coords123
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..59431b0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.Sample(x_10, float3(coords123.xy, float(int(coords123.z))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..1370d88
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords123.xy, int(coords123.z));
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..a3319b3
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 61
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %51 = OpVectorShuffle %v2float %20 %20 0 1
+ %52 = OpCompositeExtract %float %51 0
+ %53 = OpCompositeExtract %float %51 1
+ %56 = OpCompositeExtract %float %20 2
+ %55 = OpConvertFToS %int %56
+ %54 = OpConvertSToF %float %55
+ %57 = OpCompositeConstruct %v3float %52 %53 %54
+ %46 = OpImageSampleImplicitLod %v4float %50 %57
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %59 = OpLabel
+ %60 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..aa90028
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSample(x_20, x_10, coords123.xy, i32(coords123.z));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
new file mode 100644
index 0000000..8f1e46a
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleImplicitLod %v4float %78 %coords12 ConstOffset %offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..dfaec94
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.Sample(x_10, vf12, int2(3, 4));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..1ddb556
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords12, int2(3, 4));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..00b89b0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %51 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleImplicitLod %v4float %50 %16 ConstOffset %51
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..ceb1e1a
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSample(x_20, x_10, coords12, vec2<i32>(3, 4));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
new file mode 100644
index 0000000..799b1e4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleImplicitLod %v4float %78 %coords123 ConstOffset %offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..555605d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.Sample(x_10, float3(coords123.xy, float(int(coords123.z))), int2(3, 4));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..62ec168
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords123.xy, int(coords123.z), int2(3, 4));
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..2b8533c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 62
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %58 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %51 = OpVectorShuffle %v2float %20 %20 0 1
+ %52 = OpCompositeExtract %float %51 0
+ %53 = OpCompositeExtract %float %51 1
+ %56 = OpCompositeExtract %float %20 2
+ %55 = OpConvertFToS %int %56
+ %54 = OpConvertSToF %float %55
+ %57 = OpCompositeConstruct %v3float %52 %53 %54
+ %46 = OpImageSampleImplicitLod %v4float %50 %57 ConstOffset %58
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %60 = OpLabel
+ %61 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..64373e6
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSample(x_20, x_10, coords123.xy, i32(coords123.z), vec2<i32>(3, 4));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
new file mode 100644
index 0000000..1d9b92f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleImplicitLod %v4float %78 %coords12 Bias %float_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..cc97de1
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleBias(x_10, vf12, 7.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
new file mode 100644
index 0000000..845974f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords12, bias(7.0f));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..53b54aa
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %float_7 = OpConstant %float 7
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleImplicitLod %v4float %50 %16 Bias %float_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..45deb93
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleBias(x_20, x_10, coords12, 7.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
new file mode 100644
index 0000000..7606396
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleImplicitLod %v4float %78 %coords123 Bias %float_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..4cce41b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleBias(x_10, float3(coords123.xy, float(int(coords123.z))), 7.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl
new file mode 100644
index 0000000..00f0d6c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords123.xy, int(coords123.z), bias(7.0f));
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..49c3787
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 62
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %float_7 = OpConstant %float 7
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %51 = OpVectorShuffle %v2float %20 %20 0 1
+ %52 = OpCompositeExtract %float %51 0
+ %53 = OpCompositeExtract %float %51 1
+ %56 = OpCompositeExtract %float %20 2
+ %55 = OpConvertFToS %int %56
+ %54 = OpConvertSToF %float %55
+ %57 = OpCompositeConstruct %v3float %52 %53 %54
+ %46 = OpImageSampleImplicitLod %v4float %50 %57 Bias %float_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %60 = OpLabel
+ %61 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..47fc92f
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleBias(x_20, x_10, coords123.xy, i32(coords123.z), 7.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm
new file mode 100644
index 0000000..5ea07b5
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleImplicitLod %v4float %78 %coords12 Bias|ConstOffset %float_7 %offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..a7fbb8b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleBias(x_10, vf12, 7.0f, int2(3, 4));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.msl
new file mode 100644
index 0000000..cf3c642
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords12, bias(7.0f), int2(3, 4));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..4dbd27c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %float_7 = OpConstant %float 7
+ %52 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleImplicitLod %v4float %50 %16 Bias|ConstOffset %float_7 %52
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..049a22b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleBias(x_20, x_10, coords12, 7.0, vec2<i32>(3, 4));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm
new file mode 100644
index 0000000..fa4ccae
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleImplicitLod %v4float %78 %coords12 Bias|ConstOffset %float_7 %u_offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.hlsl
new file mode 100644
index 0000000..997c2cbe2
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleBias(x_10, vf12, 7.0f, int2(uint2(3u, 4u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.msl
new file mode 100644
index 0000000..1eb7977
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords12, bias(7.0f), int2(uint2(3u, 4u)));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.spvasm
new file mode 100644
index 0000000..91ee5bc
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %float_7 = OpConstant %float 7
+ %52 = OpConstantComposite %v2int %int_3 %int_3
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %46 = OpImageSampleImplicitLod %v4float %50 %16 Bias|ConstOffset %float_7 %52
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.wgsl
new file mode 100644
index 0000000..1545cfd
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleBias(x_20, x_10, coords12, 7.0, vec2<i32>(vec2<u32>(3u, 4u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm
new file mode 100644
index 0000000..ba9bbb6
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm
@@ -0,0 +1,121 @@
+; Test: ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 80
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf21 "vf21"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %coords1 "coords1"
+OpName %coords12 "coords12"
+OpName %coords123 "coords123"
+OpName %coords1234 "coords1234"
+OpName %offsets2d "offsets2d"
+OpName %u_offsets2d "u_offsets2d"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%24 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%49 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%56 = OpConstantNull %v2float
+%57 = OpConstantNull %v3float
+%58 = OpConstantNull %v4float
+%59 = OpConstantComposite %v2int %int_1 %int_2
+%60 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%61 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%62 = OpConstantComposite %v2uint %uint_1 %uint_2
+%63 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%64 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%65 = OpConstantComposite %v2float %float_1 %float_2
+%66 = OpConstantComposite %v2float %float_2 %float_1
+%67 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%68 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%70 = OpTypeSampler
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%72 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%74 = OpTypeSampledImage %72
+%10 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_72 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_70 UniformConstant
+%offsets2d = OpConstantComposite %v2int %int_3 %int_4
+%u_offsets2d = OpConstantComposite %v2uint %uint_3 %uint_4
+%1 = OpFunction %void None %24
+%75 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %65
+%vf21 = OpCopyObject %v2float %66
+%vf123 = OpCopyObject %v3float %67
+%vf1234 = OpCopyObject %v4float %68
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %59
+%vi123 = OpCopyObject %v3int %60
+%vi1234 = OpCopyObject %v4int %61
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %62
+%vu123 = OpCopyObject %v3uint %63
+%vu1234 = OpCopyObject %v4uint %64
+%coords1 = OpCopyObject %float %float_1
+%coords12 = OpCopyObject %v2float %vf12
+%coords123 = OpCopyObject %v3float %vf123
+%coords1234 = OpCopyObject %v4float %vf1234
+%76 = OpLoad %70 %10
+%77 = OpLoad %72 %20
+%78 = OpSampledImage %74 %77 %76
+%79 = OpImageSampleImplicitLod %v4float %78 %coords123 Bias|ConstOffset %float_7 %offsets2d
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.hlsl
new file mode 100644
index 0000000..f92cc32
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float2 vf21 = float2(2.0f, 1.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float coords1 = 1.0f;
+ const float2 coords12 = vf12;
+ const float3 coords123 = vf123;
+ const float4 coords1234 = vf1234;
+ const float4 x_79 = x_20.SampleBias(x_10, float3(coords123.xy, float(int(coords123.z))), 7.0f, int2(3, 4));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.msl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.msl
new file mode 100644
index 0000000..84633bc
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float2 const vf21 = float2(2.0f, 1.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const coords1 = 1.0f;
+ float2 const coords12 = vf12;
+ float3 const coords123 = vf123;
+ float4 const coords1234 = vf1234;
+ float4 const x_79 = tint_symbol_1.sample(tint_symbol_2, coords123.xy, int(coords123.z), bias(7.0f), int2(3, 4));
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.spvasm
new file mode 100644
index 0000000..42d0090
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.spvasm
@@ -0,0 +1,86 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 63
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %16 = OpConstantComposite %v2float %float_1 %float_2
+ %17 = OpConstantComposite %v2float %float_2 %float_1
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %20 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %23 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %28 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %31 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %34 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %39 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %49 = OpTypeSampledImage %6
+ %float_7 = OpConstant %float 7
+ %59 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %47 = OpLoad %3 %x_10
+ %48 = OpLoad %6 %x_20
+ %50 = OpSampledImage %49 %48 %47
+ %51 = OpVectorShuffle %v2float %20 %20 0 1
+ %52 = OpCompositeExtract %float %51 0
+ %53 = OpCompositeExtract %float %51 1
+ %56 = OpCompositeExtract %float %20 2
+ %55 = OpConvertFToS %int %56
+ %54 = OpConvertSToF %float %55
+ %57 = OpCompositeConstruct %v3float %52 %53 %54
+ %46 = OpImageSampleImplicitLod %v4float %50 %57 Bias|ConstOffset %float_7 %59
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %61 = OpLabel
+ %62 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.wgsl
new file mode 100644
index 0000000..f3e078c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf21 : vec2<f32> = vec2<f32>(2.0, 1.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let coords1 : f32 = 1.0;
+ let coords12 : vec2<f32> = vf12;
+ let coords123 : vec3<f32> = vf123;
+ let coords1234 : vec4<f32> = vf1234;
+ let x_79 : vec4<f32> = textureSampleBias(x_20, x_10, coords123.xy, i32(coords123.z), 7.0, vec2<i32>(3, 4));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..173b4ef
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..fd04635
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<float4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = float4(f1, 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..d1812a14
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(float4(f1, 0.0f, 0.0f, 0.0f), uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..43b2122
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ %45 = OpCompositeConstruct %v4float %float_1 %float_0 %float_0 %float_0
+ OpImageWrite %43 %23 %45
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..0e65cd9
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<r32float, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vec4<f32>(f1, 0.0, 0.0, 0.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..2c63545
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %vf12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..11dee90
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<float4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = float4(vf12, 0.0f, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..52da7f5
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(float4(vf12, 0.0f, 0.0f), uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..2dbce18
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ %44 = OpCompositeExtract %float %12 0
+ %45 = OpCompositeExtract %float %12 1
+ %47 = OpCompositeConstruct %v4float %44 %45 %float_0 %float_0
+ OpImageWrite %43 %23 %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..00f5da6
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<r32float, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vec4<f32>(vf12, 0.0, 0.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm
new file mode 100644
index 0000000..ffe48bc
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %vf123
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..ae87f19
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<float4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = float4(vf123, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..04ec3b1
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(float4(vf123, 0.0f), uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..545d472
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,70 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ %44 = OpCompositeExtract %float %15 0
+ %45 = OpCompositeExtract %float %15 1
+ %46 = OpCompositeExtract %float %15 2
+ %48 = OpCompositeConstruct %v4float %44 %45 %46 %float_0
+ OpImageWrite %43 %23 %48
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..831db1a
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<r32float, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vec4<f32>(vf123, 0.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm
new file mode 100644
index 0000000..7cc2494
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %vf1234
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..247c816
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<float4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = vf1234;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..9df1b41
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(vf1234, uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..74da5a3
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,65 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ OpImageWrite %43 %23 %18
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..1a90a89
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<r32float, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vf1234);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm
new file mode 100644
index 0000000..228dd41
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %vf12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..11dee90
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<float4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = float4(vf12, 0.0f, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.msl
new file mode 100644
index 0000000..52da7f5
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(float4(vf12, 0.0f, 0.0f), uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..48172e2
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.spvasm
@@ -0,0 +1,70 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ %44 = OpCompositeExtract %float %12 0
+ %45 = OpCompositeExtract %float %12 1
+ %47 = OpCompositeConstruct %v4float %44 %45 %float_0 %float_0
+ OpImageWrite %43 %23 %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..11e28a6
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<rg32float, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vec4<f32>(vf12, 0.0, 0.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm
new file mode 100644
index 0000000..1501e62
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %vf123
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..ae87f19
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<float4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = float4(vf123, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.msl
new file mode 100644
index 0000000..04ec3b1
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(float4(vf123, 0.0f), uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..643e924
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ %44 = OpCompositeExtract %float %15 0
+ %45 = OpCompositeExtract %float %15 1
+ %46 = OpCompositeExtract %float %15 2
+ %48 = OpCompositeConstruct %v4float %44 %45 %46 %float_0
+ OpImageWrite %43 %23 %48
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..66c3140
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<rg32float, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vec4<f32>(vf123, 0.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm
new file mode 100644
index 0000000..aefe7fc
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %vf1234
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..247c816
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<float4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = vf1234;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.msl
new file mode 100644
index 0000000..9df1b41
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(vf1234, uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..630dc28
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ OpImageWrite %43 %23 %18
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..7b752c7
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<rg32float, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vf1234);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm
new file mode 100644
index 0000000..66a503c
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 0 2 Rgba32f
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %vf1234
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.hlsl
new file mode 100644
index 0000000..247c816
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<float4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = vf1234;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.msl
new file mode 100644
index 0000000..9df1b41
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(vf1234, uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.spvasm
new file mode 100644
index 0000000..56c5392
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.spvasm
@@ -0,0 +1,65 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 2 Rgba32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ OpImageWrite %43 %23 %18
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.wgsl
new file mode 100644
index 0000000..d0c05f4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32float, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vf1234);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..afbefb9
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %vu1234
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..e3e7108
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<uint4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = vu1234;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..ffcc7eb
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<uint, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(vu1234, uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<uint, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..75f775e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,65 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %uint = OpTypeInt 32 0
+ %3 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %13 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %16 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %19 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %24 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %27 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %30 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ OpImageWrite %43 %24 %40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..dbddd5b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32uint, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vu1234);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..9f6444e
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %int 2D 0 0 0 2 Rgba32i
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %vi1234
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..3a143b1
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<int4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = vi1234;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..4c3c05b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<int, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(vi1234, uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<int, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..0951fe5
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,65 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %int = OpTypeInt 32 1
+ %3 = OpTypeImage %int 2D 0 0 0 2 Rgba32i
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %13 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %16 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %19 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ OpImageWrite %43 %23 %29
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..99f8aea
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32sint, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vi1234);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..e864943
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %uint 2D 0 0 0 2 R32ui
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %vu12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..0b05d87
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<uint4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = uint4(vu12, 0u, 0u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..2935498
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<uint, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(uint4(vu12, 0u, 0u), uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<uint, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..2621eb7
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %uint = OpTypeInt 32 0
+ %3 = OpTypeImage %uint 2D 0 0 0 2 R32ui
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %13 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %16 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %19 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %24 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %27 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %30 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ %44 = OpCompositeExtract %uint %34 0
+ %45 = OpCompositeExtract %uint %34 1
+ %47 = OpCompositeConstruct %v4uint %44 %45 %uint_0 %uint_0
+ OpImageWrite %43 %24 %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..71e539d
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<r32uint, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vec4<u32>(vu12, 0u, 0u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm
new file mode 100644
index 0000000..c28415b
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %int 2D 0 0 0 2 R32i
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %vi12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..1e84180
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<int4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = int4(vi12, 0, 0);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..7d520f0
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<int, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(int4(vi12, 0, 0), uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<int, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..9ea9534
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %int = OpTypeInt 32 1
+ %3 = OpTypeImage %int 2D 0 0 0 2 R32i
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %13 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %16 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %19 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %int_0 = OpConstant %int 0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ %44 = OpCompositeExtract %int %23 0
+ %45 = OpCompositeExtract %int %23 1
+ %47 = OpCompositeConstruct %v4int %44 %45 %int_0 %int_0
+ OpImageWrite %43 %23 %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..ba6ec48
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<r32sint, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vec4<i32>(vi12, 0, 0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm b/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
new file mode 100644
index 0000000..7fbbf93
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
@@ -0,0 +1,99 @@
+; Test: ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 67
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %offsets2d "offsets2d"
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%16 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%41 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%48 = OpConstantNull %v2float
+%49 = OpConstantNull %v3float
+%50 = OpConstantNull %v4float
+%51 = OpConstantComposite %v2int %int_1 %int_2
+%52 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%53 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%54 = OpConstantComposite %v2uint %uint_1 %uint_2
+%55 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%56 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%57 = OpConstantComposite %v2float %float_1 %float_2
+%58 = OpConstantComposite %v2float %float_2 %float_1
+%59 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%60 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%62 = OpTypeImage %float 2D 0 0 0 2 Rgba32f
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%20 = OpVariable %_ptr_UniformConstant_62 UniformConstant
+%1 = OpFunction %void None %16
+%64 = OpLabel
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %57
+%vf123 = OpCopyObject %v3float %59
+%vf1234 = OpCopyObject %v4float %60
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %51
+%vi123 = OpCopyObject %v3int %52
+%vi1234 = OpCopyObject %v4int %53
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %54
+%vu123 = OpCopyObject %v3uint %55
+%vu1234 = OpCopyObject %v4uint %56
+%65 = OpCompositeConstruct %v2int %int_3 %int_4
+%offsets2d = OpCopyObject %v2int %65
+%66 = OpLoad %62 %20
+OpImageWrite %66 %vi12 %vf1234
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..247c816
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+RWTexture2D<float4> x_20 : register(u1, space2);
+
+void main_1() {
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const int2 offsets2d = int2(3, 4);
+ x_20[vi12] = vf1234;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..9df1b41
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::write> tint_symbol_1) {
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ int2 const offsets2d = int2(3, 4);
+ tint_symbol_1.write(vf1234, uint2(vi12));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..56c5392
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,65 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 2 Rgba32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %12 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %23 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %26 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %29 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %34 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %37 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %40 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %41 = OpConstantComposite %v2int %int_3 %int_4
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %43 = OpLoad %3 %x_20
+ OpImageWrite %43 %23 %18
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..d0c05f4
--- /dev/null
+++ b/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<rgba32float, write>;
+
+fn main_1() {
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let offsets2d : vec2<i32> = vec2<i32>(3, 4);
+ textureStore(x_20, vi12, vf1234);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm
new file mode 100644
index 0000000..103bb3d
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm
@@ -0,0 +1,142 @@
+; Test: Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 124
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%28 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%35 = OpConstantNull %v2float
+%36 = OpConstantNull %v3float
+%37 = OpConstantNull %v4float
+%38 = OpConstantComposite %v2int %int_1 %int_2
+%39 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%40 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%41 = OpConstantComposite %v2uint %uint_1 %uint_2
+%42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%43 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%44 = OpConstantComposite %v2float %float_1 %float_2
+%45 = OpConstantComposite %v2float %float_2 %float_1
+%46 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%49 = OpTypeSampler
+%50 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%51 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%53 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%55 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%56 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%58 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%59 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%61 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%62 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%63 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%65 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%67 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%68 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%70 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%71 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%73 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%74 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%75 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%77 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%79 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%80 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%82 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%83 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%85 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_49 = OpTypePointer UniformConstant %49
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%10 = OpVariable %_ptr_UniformConstant_50 UniformConstant
+%1 = OpFunction %void None %3
+%123 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..bc1d9f0
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+Texture1D<float4> x_10 : register(t0, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..8313226
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..aae3c19
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+[[group(0), binding(0)]] var x_10 : texture_1d<f32>;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm
new file mode 100644
index 0000000..57870aa
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm
@@ -0,0 +1,143 @@
+; Test: Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 124
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %10 NonWritable
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%28 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%35 = OpConstantNull %v2float
+%36 = OpConstantNull %v3float
+%37 = OpConstantNull %v4float
+%38 = OpConstantComposite %v2int %int_1 %int_2
+%39 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%40 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%41 = OpConstantComposite %v2uint %uint_1 %uint_2
+%42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%43 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%44 = OpConstantComposite %v2float %float_1 %float_2
+%45 = OpConstantComposite %v2float %float_2 %float_1
+%46 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%49 = OpTypeSampler
+%50 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%51 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%53 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%55 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%56 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%58 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%59 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%61 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%62 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%63 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%65 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%67 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%68 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%70 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%71 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%73 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%74 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%75 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%77 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%79 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%80 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%82 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%83 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%85 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_49 = OpTypePointer UniformConstant %49
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%10 = OpVariable %_ptr_UniformConstant_58 UniformConstant
+%1 = OpFunction %void None %3
+%123 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..bc1d9f0
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+Texture1D<float4> x_10 : register(t0, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..e27fc57
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 NonWritable
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..0cd9014
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+[[group(0), binding(0)]] var x_10 : texture_storage_1d<rg32float, read>;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm
new file mode 100644
index 0000000..96cf0cf
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm
@@ -0,0 +1,143 @@
+; Test: Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 124
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %10 NonReadable
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%28 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%35 = OpConstantNull %v2float
+%36 = OpConstantNull %v3float
+%37 = OpConstantNull %v4float
+%38 = OpConstantComposite %v2int %int_1 %int_2
+%39 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%40 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%41 = OpConstantComposite %v2uint %uint_1 %uint_2
+%42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%43 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%44 = OpConstantComposite %v2float %float_1 %float_2
+%45 = OpConstantComposite %v2float %float_2 %float_1
+%46 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%49 = OpTypeSampler
+%50 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%51 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%53 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%55 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%56 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%58 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%59 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%61 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%62 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%63 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%65 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%67 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%68 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%70 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%71 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%73 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%74 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%75 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%77 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%79 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%80 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%82 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%83 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%85 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_49 = OpTypePointer UniformConstant %49
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%10 = OpVariable %_ptr_UniformConstant_58 UniformConstant
+%1 = OpFunction %void None %3
+%123 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..8f1936b
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+RWTexture1D<float4> x_10 : register(u0, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..d534af7
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 NonReadable
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..5f7b40a
--- /dev/null
+++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+[[group(0), binding(0)]] var x_10 : texture_storage_1d<rg32float, write>;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm b/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm
new file mode 100644
index 0000000..2e5fd8c
--- /dev/null
+++ b/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm
@@ -0,0 +1,110 @@
+; Test: Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+%71 = OpImageQuerySamples %uint %70
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..675bb94
--- /dev/null
+++ b/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DMS<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ int3 tint_tmp;
+ x_20.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const uint x_71 = uint(tint_tmp.z);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.msl b/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.msl
new file mode 100644
index 0000000..9986bb6
--- /dev/null
+++ b/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_ms<float, access::read> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ uint const x_71 = uint(int(tint_symbol_1.get_num_samples()));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d_ms<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..99757d0
--- /dev/null
+++ b/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %50 = OpLoad %6 %x_20
+ %49 = OpImageQuerySamples %int %50
+ %48 = OpBitcast %uint %49
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..a79ff60
--- /dev/null
+++ b/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_multisampled_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_71 : u32 = u32(textureNumSamples(x_20));
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
new file mode 100644
index 0000000..c810e7c
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
@@ -0,0 +1,112 @@
+; Test: PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf123
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..0b1e681
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, float3(vf123.xy, float(int(vf123.z))));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
new file mode 100644
index 0000000..c35f357
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf123.xy, int(vf123.z));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..7645a19
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 64
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %53 = OpVectorShuffle %v2float %44 %44 0 1
+ %54 = OpCompositeExtract %float %53 0
+ %55 = OpCompositeExtract %float %53 1
+ %58 = OpCompositeExtract %float %44 2
+ %57 = OpConvertFToS %int %58
+ %56 = OpConvertSToF %float %57
+ %59 = OpCompositeConstruct %v3float %54 %55 %56
+ %48 = OpImageSampleImplicitLod %v4float %52 %59
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %62 = OpLabel
+ %63 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..a5f904a
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf123.xy, i32(vf123.z));
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
new file mode 100644
index 0000000..ce27ad0
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
@@ -0,0 +1,112 @@
+; Test: PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleExplicitLod %v4float %72 %vf123 Lod %f1
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..0a0812e
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2DArray<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.SampleLevel(x_10, float3(vf123.xy, float(int(vf123.z))), f1);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
new file mode 100644
index 0000000..115552a
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf123.xy, int(vf123.z), level(f1));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..c2ba135
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 64
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %53 = OpVectorShuffle %v2float %44 %44 0 1
+ %54 = OpCompositeExtract %float %53 0
+ %55 = OpCompositeExtract %float %53 1
+ %58 = OpCompositeExtract %float %44 2
+ %57 = OpConvertFToS %int %58
+ %56 = OpConvertSToF %float %57
+ %59 = OpCompositeConstruct %v3float %54 %55 %56
+ %48 = OpImageSampleExplicitLod %v4float %52 %59 Lod %float_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %62 = OpLabel
+ %63 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..3e2748d
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSampleLevel(x_20, x_10, vf123.xy, i32(vf123.z), f1);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
new file mode 100644
index 0000000..16cadc9
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
@@ -0,0 +1,112 @@
+; Test: PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 1 1 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleDrefImplicitLod %float %72 %vf123 %float_0_200000003
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..63be007
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerComparisonState x_10 : register(s0, space0);
+Texture2DArray x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float x_73 = x_20.SampleCmp(x_10, float3(vf123.xy, float(int(vf123.z))), 0.200000003f);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
new file mode 100644
index 0000000..433bf89
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float const x_73 = tint_symbol_1.sample_compare(tint_symbol_2, vf123.xy, int(vf123.z), 0.200000003f);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(depth2d_array<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..70122c9
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 66
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %21 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %24 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %27 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %32 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %35 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %38 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %42 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %45 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %48 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %52 = OpTypeSampledImage %6
+%float_0_200000003 = OpConstant %float 0.200000003
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %16
+ %50 = OpLoad %3 %x_10
+ %51 = OpLoad %6 %x_20
+ %53 = OpSampledImage %52 %51 %50
+ %54 = OpVectorShuffle %v2float %45 %45 0 1
+ %55 = OpCompositeExtract %float %54 0
+ %56 = OpCompositeExtract %float %54 1
+ %59 = OpCompositeExtract %float %45 2
+ %58 = OpConvertFToS %int %59
+ %57 = OpConvertSToF %float %58
+ %60 = OpCompositeConstruct %v3float %55 %56 %57
+ %49 = OpImageSampleDrefImplicitLod %float %53 %60 %float_0_200000003
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %64 = OpLabel
+ %65 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..af05101
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d_array;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : f32 = textureSampleCompare(x_20, x_10, vf123.xy, i32(vf123.z), 0.200000003);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
new file mode 100644
index 0000000..b53b3aa
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
@@ -0,0 +1,112 @@
+; Test: PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %f1
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..5d99a18
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, f1);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
new file mode 100644
index 0000000..a1ec20a
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, f1);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..15138de
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %48 = OpImageSampleImplicitLod %v4float %52 %float_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..193ebee
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_1d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, f1);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
new file mode 100644
index 0000000..8df911c
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
@@ -0,0 +1,112 @@
+; Test: PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleImplicitLod %v4float %72 %vf12
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..e80450b
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Sample(x_10, vf12);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
new file mode 100644
index 0000000..0d1252f
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf12);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..d065038
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %48 = OpImageSampleImplicitLod %v4float %52 %41
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb63d93
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSample(x_20, x_10, vf12);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm
new file mode 100644
index 0000000..baacd1b
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm
@@ -0,0 +1,112 @@
+; Test: PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleExplicitLod %v4float %72 %vf12 Lod %f1
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..8cfe6f4
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.SampleLevel(x_10, vf12, f1);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl
new file mode 100644
index 0000000..3bb2499
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.sample(tint_symbol_2, vf12, level(f1));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..16c8bf6
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %51 = OpTypeSampledImage %6
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %3 %x_10
+ %50 = OpLoad %6 %x_20
+ %52 = OpSampledImage %51 %50 %49
+ %48 = OpImageSampleExplicitLod %v4float %52 %41 Lod %float_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..f5408be
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureSampleLevel(x_20, x_10, vf12, f1);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm
new file mode 100644
index 0000000..5e0cc22
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm
@@ -0,0 +1,112 @@
+; Test: PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageSampleDrefImplicitLod %float %72 %vf12 %float_0_200000003
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..e89c169
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerComparisonState x_10 : register(s0, space0);
+Texture2D x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float x_73 = x_20.SampleCmp(x_10, vf12, 0.200000003f);
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.msl
new file mode 100644
index 0000000..c8f870d
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float const x_73 = tint_symbol_1.sample_compare(tint_symbol_2, vf12, 0.200000003f);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..d88517e
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+%_ptr_UniformConstant_3_0 = OpTypePointer UniformConstant %3
+ %x_30 = OpVariable %_ptr_UniformConstant_3_0 UniformConstant
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %21 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %24 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %27 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %32 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %35 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %38 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %42 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %45 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %48 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %52 = OpTypeSampledImage %6
+%float_0_200000003 = OpConstant %float 0.200000003
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %16
+ %50 = OpLoad %3 %x_10
+ %51 = OpLoad %6 %x_20
+ %53 = OpSampledImage %52 %51 %50
+ %49 = OpImageSampleDrefImplicitLod %float %53 %42 %float_0_200000003
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..fc93a17
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(2), binding(1)]] var x_20 : texture_depth_2d;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : f32 = textureSampleCompare(x_20, x_10, vf12, 0.200000003);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
new file mode 100644
index 0000000..081d724
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
@@ -0,0 +1,112 @@
+; Test: PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageFetch %v4float %71 %vi123
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
new file mode 100644
index 0000000..6f308d5
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::sample> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.read(uint2(vi123.xy), vi123.z, 0);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..a9b420a
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 60
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int_0 = OpConstant %int 0
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %50 = OpVectorShuffle %v2int %23 %23 0 1
+ %51 = OpCompositeExtract %int %50 0
+ %52 = OpCompositeExtract %int %50 1
+ %53 = OpCompositeExtract %int %23 2
+ %54 = OpCompositeConstruct %v3int %51 %52 %53
+ %48 = OpImageFetch %v4float %49 %54 Lod %int_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..b695621
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d_array<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureLoad(x_20, vi123.xy, vi123.z, 0);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
new file mode 100644
index 0000000..4a06b79
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
@@ -0,0 +1,110 @@
+; Test: PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 1 0 2 R32f
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+%71 = OpImageRead %v4float %70 %vi123
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
new file mode 100644
index 0000000..f1e2f5b
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
@@ -0,0 +1,28 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::read> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_71 = tint_symbol_1.read(uint2(vi123.xy), vi123.z);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..74200f2
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
@@ -0,0 +1,85 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 2 R32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %50 = OpVectorShuffle %v2int %23 %23 0 1
+ %51 = OpCompositeExtract %int %50 0
+ %52 = OpCompositeExtract %int %50 1
+ %53 = OpCompositeExtract %int %23 2
+ %54 = OpCompositeConstruct %v3int %51 %52 %53
+ %48 = OpImageRead %v4float %49 %54
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..41b4743
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
@@ -0,0 +1,30 @@
+warning: use of deprecated intrinsic
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_2d_array<r32float, read>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_71 : vec4<f32> = textureLoad(x_20, vi123.xy, vi123.z);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
new file mode 100644
index 0000000..806dbc1
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
@@ -0,0 +1,110 @@
+; Test: PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 1 0 2 R32f
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+OpImageWrite %70 %vi123 %vf1234
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..6b702c0
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+RWTexture2DArray<float4> x_20 : register(u1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ x_20[int3(vi123.xy, vi123.z)] = vf1234;
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
new file mode 100644
index 0000000..fd02394
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_array<float, access::write> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ tint_symbol_1.write(vf1234, uint2(vi123.xy), vi123.z);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d_array<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..9b7d609
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 1 0 2 R32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %50 = OpVectorShuffle %v2int %23 %23 0 1
+ %51 = OpCompositeExtract %int %50 0
+ %52 = OpCompositeExtract %int %50 1
+ %53 = OpCompositeExtract %int %23 2
+ %54 = OpCompositeConstruct %v3int %51 %52 %53
+ OpImageWrite %49 %54 %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..c57e52c
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_2d_array<r32float, write>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ textureStore(x_20, vi123.xy, vi123.z, vf1234);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
new file mode 100644
index 0000000..74f95e1
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
@@ -0,0 +1,112 @@
+; Test: PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageFetch %v4float %71 %i1
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..66bd7b1
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Load(int2(i1, 0));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
new file mode 100644
index 0000000..114e6a6
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::sample> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.read(uint(i1), 0);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..80160fc
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int_0 = OpConstant %int 0
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %48 = OpImageFetch %v4float %49 %int_1 Lod %int_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..67965cc
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_1d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureLoad(x_20, i1, 0);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
new file mode 100644
index 0000000..976b6a3
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
@@ -0,0 +1,110 @@
+; Test: PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 1D 0 0 0 2 R32f
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+%71 = OpImageRead %v4float %70 %i1
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..4e14e7b
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+warning: use of deprecated intrinsic
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_71 = x_20.Load(int2(i1, 0));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
new file mode 100644
index 0000000..63947de
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl
@@ -0,0 +1,28 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::read> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_71 = tint_symbol_1.read(uint(i1));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..92691a2
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.spvasm
@@ -0,0 +1,81 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 2 R32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %48 = OpImageRead %v4float %49 %int_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..4877caa
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.wgsl
@@ -0,0 +1,30 @@
+warning: use of deprecated intrinsic
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_1d<r32float, read>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_71 : vec4<f32> = textureLoad(x_20, i1);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
new file mode 100644
index 0000000..85af78d
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
@@ -0,0 +1,110 @@
+; Test: PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 1D 0 0 0 2 R32f
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+OpImageWrite %70 %i1 %vf1234
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..d337988
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+RWTexture1D<float4> x_20 : register(u1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ x_20[i1] = vf1234;
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
new file mode 100644
index 0000000..8c9200b
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::write> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ tint_symbol_1.write(vf1234, uint(i1));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..97b34b3
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 2 R32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ OpImageWrite %49 %int_1 %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..baaf43c
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_1d<r32float, write>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ textureStore(x_20, i1, vf1234);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm
new file mode 100644
index 0000000..b612863
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm
@@ -0,0 +1,112 @@
+; Test: PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%68 = OpTypeSampledImage %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%69 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%70 = OpLoad %64 %10
+%71 = OpLoad %66 %20
+%72 = OpSampledImage %68 %71 %70
+%73 = OpImageFetch %v4float %71 %vi12
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..b7ff9fd
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_73 = x_20.Load(int3(vi12, 0));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl
new file mode 100644
index 0000000..b558cba
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_73 = tint_symbol_1.read(uint2(vi12), 0);
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..b3d4848
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %int_0 = OpConstant %int 0
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %48 = OpImageFetch %v4float %49 %20 Lod %int_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..5fdecc4
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_73 : vec4<f32> = textureLoad(x_20, vi12, 0);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm
new file mode 100644
index 0000000..15d6b83
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm
@@ -0,0 +1,110 @@
+; Test: PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+%71 = OpImageRead %v4float %70 %vi12
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..cac0179
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+warning: use of deprecated intrinsic
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 x_71 = x_20.Load(int3(vi12, 0));
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.msl
new file mode 100644
index 0000000..e34199f
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.msl
@@ -0,0 +1,28 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::read> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const x_71 = tint_symbol_1.read(uint2(vi12));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::read> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..bd3810f
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.spvasm
@@ -0,0 +1,80 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ %48 = OpImageRead %v4float %49 %20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..3eb6605
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.wgsl
@@ -0,0 +1,30 @@
+warning: use of deprecated intrinsic
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<r32float, read>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let x_71 : vec4<f32> = textureLoad(x_20, vi12);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm
new file mode 100644
index 0000000..0b32cb6
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm
@@ -0,0 +1,110 @@
+; Test: PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1001
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %float_var "float_var"
+OpName %ptr_float "ptr_float"
+OpName %i1 "i1"
+OpName %vi12 "vi12"
+OpName %vi123 "vi123"
+OpName %vi1234 "vi1234"
+OpName %u1 "u1"
+OpName %vu12 "vu12"
+OpName %vu123 "vu123"
+OpName %vu1234 "vu1234"
+OpName %f1 "f1"
+OpName %vf12 "vf12"
+OpName %vf123 "vf123"
+OpName %vf1234 "vf1234"
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 2
+OpDecorate %20 Binding 1
+OpDecorate %30 DescriptorSet 0
+OpDecorate %30 Binding 1
+%void = OpTypeVoid
+%17 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%43 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%50 = OpConstantNull %v2float
+%51 = OpConstantNull %v3float
+%52 = OpConstantNull %v4float
+%53 = OpConstantComposite %v2int %int_1 %int_2
+%54 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%55 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%56 = OpConstantComposite %v2uint %uint_1 %uint_2
+%57 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%58 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%59 = OpConstantComposite %v2float %float_1 %float_2
+%60 = OpConstantComposite %v2float %float_2 %float_1
+%61 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%62 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%64 = OpTypeSampler
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%66 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%ptr_float = OpTypePointer Function %float
+%10 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_66 UniformConstant
+%30 = OpVariable %_ptr_UniformConstant_64 UniformConstant
+%100 = OpFunction %void None %17
+%68 = OpLabel
+%float_var = OpVariable %ptr_float Function
+%i1 = OpCopyObject %int %int_1
+%vi12 = OpCopyObject %v2int %53
+%vi123 = OpCopyObject %v3int %54
+%vi1234 = OpCopyObject %v4int %55
+%u1 = OpCopyObject %uint %uint_1
+%vu12 = OpCopyObject %v2uint %56
+%vu123 = OpCopyObject %v3uint %57
+%vu1234 = OpCopyObject %v4uint %58
+%f1 = OpCopyObject %float %float_1
+%vf12 = OpCopyObject %v2float %59
+%vf123 = OpCopyObject %v3float %61
+%vf1234 = OpCopyObject %v4float %62
+%69 = OpLoad %64 %10
+%70 = OpLoad %66 %20
+OpImageWrite %70 %vi12 %vf1234
+%1000 = OpCopyObject %uint %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..d6a9080
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+SamplerState x_10 : register(s0, space0);
+RWTexture2D<float4> x_20 : register(u1, space2);
+SamplerState x_30 : register(s1, space0);
+
+void main_1() {
+ float float_var = 0.0f;
+ const int i1 = 1;
+ const int2 vi12 = int2(1, 2);
+ const int3 vi123 = int3(1, 2, 3);
+ const int4 vi1234 = int4(1, 2, 3, 4);
+ const uint u1 = 1u;
+ const uint2 vu12 = uint2(1u, 2u);
+ const uint3 vu123 = uint3(1u, 2u, 3u);
+ const uint4 vu1234 = uint4(1u, 2u, 3u, 4u);
+ const float f1 = 1.0f;
+ const float2 vf12 = float2(1.0f, 2.0f);
+ const float3 vf123 = float3(1.0f, 2.0f, 3.0f);
+ const float4 vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ x_20[vi12] = vf1234;
+ const uint x_1000 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.msl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.msl
new file mode 100644
index 0000000..7fdda0e
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::write> tint_symbol_1) {
+ float float_var = 0.0f;
+ int const i1 = 1;
+ int2 const vi12 = int2(1, 2);
+ int3 const vi123 = int3(1, 2, 3);
+ int4 const vi1234 = int4(1, 2, 3, 4);
+ uint const u1 = 1u;
+ uint2 const vu12 = uint2(1u, 2u);
+ uint3 const vu123 = uint3(1u, 2u, 3u);
+ uint4 const vu1234 = uint4(1u, 2u, 3u, 4u);
+ float const f1 = 1.0f;
+ float2 const vf12 = float2(1.0f, 2.0f);
+ float3 const vf123 = float3(1.0f, 2.0f, 3.0f);
+ float4 const vf1234 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ tint_symbol_1.write(vf1234, uint2(vi12));
+ uint const x_1000 = 0u;
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::write> tint_symbol_2 [[texture(1)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..8fff5dd
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %x_30 "x_30"
+ OpName %main_1 "main_1"
+ OpName %float_var "float_var"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 2
+ OpDecorate %x_20 Binding 1
+ OpDecorate %x_30 DescriptorSet 0
+ OpDecorate %x_30 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 2 R32f
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %x_30 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %int_2 = OpConstant %int 2
+ %20 = OpConstantComposite %v2int %int_1 %int_2
+ %v3int = OpTypeVector %int 3
+ %int_3 = OpConstant %int 3
+ %23 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+ %v4int = OpTypeVector %int 4
+ %int_4 = OpConstant %int 4
+ %26 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2uint = OpTypeVector %uint 2
+ %uint_2 = OpConstant %uint 2
+ %31 = OpConstantComposite %v2uint %uint_1 %uint_2
+ %v3uint = OpTypeVector %uint 3
+ %uint_3 = OpConstant %uint 3
+ %34 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %uint_4 = OpConstant %uint 4
+ %37 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+ %float_1 = OpConstant %float 1
+ %v2float = OpTypeVector %float 2
+ %float_2 = OpConstant %float 2
+ %41 = OpConstantComposite %v2float %float_1 %float_2
+ %v3float = OpTypeVector %float 3
+ %float_3 = OpConstant %float 3
+ %44 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %v4float = OpTypeVector %float 4
+ %float_4 = OpConstant %float 4
+ %47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %float_var = OpVariable %_ptr_Function_float Function %15
+ %49 = OpLoad %6 %x_20
+ OpImageWrite %49 %20 %47
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..322a9bf
--- /dev/null
+++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(2), binding(1)]] var x_20 : texture_storage_2d<r32float, write>;
+
+[[group(0), binding(1)]] var x_30 : sampler;
+
+fn main_1() {
+ var float_var : f32;
+ let i1 : i32 = 1;
+ let vi12 : vec2<i32> = vec2<i32>(1, 2);
+ let vi123 : vec3<i32> = vec3<i32>(1, 2, 3);
+ let vi1234 : vec4<i32> = vec4<i32>(1, 2, 3, 4);
+ let u1 : u32 = 1u;
+ let vu12 : vec2<u32> = vec2<u32>(1u, 2u);
+ let vu123 : vec3<u32> = vec3<u32>(1u, 2u, 3u);
+ let vu1234 : vec4<u32> = vec4<u32>(1u, 2u, 3u, 4u);
+ let f1 : f32 = 1.0;
+ let vf12 : vec2<f32> = vec2<f32>(1.0, 2.0);
+ let vf123 : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
+ let vf1234 : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ textureStore(x_20, vi12, vf1234);
+ let x_1000 : u32 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm b/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm
new file mode 100644
index 0000000..bd867dd
--- /dev/null
+++ b/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm
@@ -0,0 +1,143 @@
+; Test: Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 125
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%28 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%35 = OpConstantNull %v2float
+%36 = OpConstantNull %v3float
+%37 = OpConstantNull %v4float
+%38 = OpConstantComposite %v2int %int_1 %int_2
+%39 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%40 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%41 = OpConstantComposite %v2uint %uint_1 %uint_2
+%42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%43 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%44 = OpConstantComposite %v2float %float_1 %float_2
+%45 = OpConstantComposite %v2float %float_2 %float_1
+%46 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%49 = OpTypeSampler
+%50 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%51 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%53 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%55 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%56 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%58 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%59 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%61 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%62 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%63 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%65 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%67 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%68 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%70 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%71 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%73 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%74 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%75 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%77 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%79 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%80 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%82 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%83 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%85 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_49 = OpTypePointer UniformConstant %49
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%_ptr_UniformConstant_49_0 = OpTypePointer UniformConstant %49
+%10 = OpVariable %_ptr_UniformConstant_49_0 UniformConstant
+%1 = OpFunction %void None %3
+%124 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..6de43b2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+SamplerState x_10 : register(s0, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..2fb8878
--- /dev/null
+++ b/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %4 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %4
+ %7 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %4
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..a564925
--- /dev/null
+++ b/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm
new file mode 100644
index 0000000..315d47e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_LocalInvocationIndex
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpAccessChain %_ptr_Input_uint %gl_LocalInvocationIndex
+%2 = OpLoad %uint %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..f496a7d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint x_1 = 0u;
+
+void main_1() {
+ const uint x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_GroupIndex;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.msl
new file mode 100644
index 0000000..7e7cc9a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_2) {
+ uint const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint x_1_param [[thread_index_in_threadgroup]]) {
+ thread uint tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..9e443ff
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ %11 = OpLoad %uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %13 = OpLabel
+ %14 = OpLoad %uint %tint_symbol
+ OpStore %x_1 %14
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..e877436
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : u32;
+
+fn main_1() {
+ let x_2 : u32 = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(local_invocation_index)]] x_1_param : u32) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm
new file mode 100644
index 0000000..68c3ef1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_LocalInvocationIndex
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_LocalInvocationIndex = OpVariable %_ptr_Input_int Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpAccessChain %_ptr_Input_int %gl_LocalInvocationIndex
+%2 = OpLoad %int %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..983314b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static int x_1 = 0;
+
+void main_1() {
+ const int x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_GroupIndex;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.msl
new file mode 100644
index 0000000..d6228c7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int* const tint_symbol_2) {
+ int const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint x_1_param [[thread_index_in_threadgroup]]) {
+ thread int tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..230fe6a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %4 = OpConstantNull %int
+ %x_1 = OpVariable %_ptr_Private_int Private %4
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %16 = OpLoad %uint %tint_symbol
+ %15 = OpBitcast %int %16
+ OpStore %x_1 %15
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..325c2c5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : i32;
+
+fn main_1() {
+ let x_2 : i32 = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(local_invocation_index)]] x_1_param : u32) {
+ x_1 = bitcast<i32>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm
new file mode 100644
index 0000000..6c78f20
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_LocalInvocationID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpAccessChain %_ptr_Input_v3uint %gl_LocalInvocationID
+%2 = OpLoad %v3uint %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..ab2e231
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint3 x_1 = uint3(0u, 0u, 0u);
+
+void main_1() {
+ const uint3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_GroupThreadID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.msl
new file mode 100644
index 0000000..b153c9e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint3* const tint_symbol_2) {
+ uint3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[thread_position_in_threadgroup]]) {
+ thread uint3 tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..9e60c0e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn LocalInvocationId
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Private_v3uint = OpTypePointer Private %v3uint
+ %5 = OpConstantNull %v3uint
+ %x_1 = OpVariable %_ptr_Private_v3uint Private %5
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %v3uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %15 = OpLoad %v3uint %tint_symbol
+ OpStore %x_1 %15
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..d287187
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : vec3<u32>;
+
+fn main_1() {
+ let x_2 : vec3<u32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(local_invocation_id)]] x_1_param : vec3<u32>) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm
new file mode 100644
index 0000000..b08cc3e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_LocalInvocationID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3int = OpTypePointer Input %v3int
+%gl_LocalInvocationID = OpVariable %_ptr_Input_v3int Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpAccessChain %_ptr_Input_v3int %gl_LocalInvocationID
+%2 = OpLoad %v3int %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..9b5b8cc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static int3 x_1 = int3(0, 0, 0);
+
+void main_1() {
+ const int3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_GroupThreadID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.msl
new file mode 100644
index 0000000..bdf373b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int3* const tint_symbol_2) {
+ int3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[thread_position_in_threadgroup]]) {
+ thread int3 tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int3>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..d489e17
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn LocalInvocationId
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+%_ptr_Private_v3int = OpTypePointer Private %v3int
+ %5 = OpConstantNull %v3int
+ %x_1 = OpVariable %_ptr_Private_v3int Private %5
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %14 = OpLoad %v3int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %16 = OpLabel
+ %18 = OpLoad %v3uint %tint_symbol
+ %17 = OpBitcast %v3int %18
+ OpStore %x_1 %17
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..d5f74d9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : vec3<i32>;
+
+fn main_1() {
+ let x_2 : vec3<i32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(local_invocation_id)]] x_1_param : vec3<u32>) {
+ x_1 = bitcast<vec3<i32>>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm
new file mode 100644
index 0000000..1843c3f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_GlobalInvocationID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpAccessChain %_ptr_Input_v3uint %gl_GlobalInvocationID
+%2 = OpLoad %v3uint %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..1808399
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint3 x_1 = uint3(0u, 0u, 0u);
+
+void main_1() {
+ const uint3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_DispatchThreadID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.msl
new file mode 100644
index 0000000..b636006
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint3* const tint_symbol_2) {
+ uint3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[thread_position_in_grid]]) {
+ thread uint3 tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..aedb68e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn GlobalInvocationId
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Private_v3uint = OpTypePointer Private %v3uint
+ %5 = OpConstantNull %v3uint
+ %x_1 = OpVariable %_ptr_Private_v3uint Private %5
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %v3uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %15 = OpLoad %v3uint %tint_symbol
+ OpStore %x_1 %15
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..eb4dd00
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : vec3<u32>;
+
+fn main_1() {
+ let x_2 : vec3<u32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(global_invocation_id)]] x_1_param : vec3<u32>) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm
new file mode 100644
index 0000000..3048657
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_GlobalInvocationID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3int = OpTypePointer Input %v3int
+%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3int Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpAccessChain %_ptr_Input_v3int %gl_GlobalInvocationID
+%2 = OpLoad %v3int %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..4c89479
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static int3 x_1 = int3(0, 0, 0);
+
+void main_1() {
+ const int3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_DispatchThreadID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.msl
new file mode 100644
index 0000000..98f26ba
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int3* const tint_symbol_2) {
+ int3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[thread_position_in_grid]]) {
+ thread int3 tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int3>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..333a5bc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn GlobalInvocationId
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+%_ptr_Private_v3int = OpTypePointer Private %v3int
+ %5 = OpConstantNull %v3int
+ %x_1 = OpVariable %_ptr_Private_v3int Private %5
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %14 = OpLoad %v3int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %16 = OpLabel
+ %18 = OpLoad %v3uint %tint_symbol
+ %17 = OpBitcast %v3int %18
+ OpStore %x_1 %17
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..f57b424
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : vec3<i32>;
+
+fn main_1() {
+ let x_2 : vec3<i32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(global_invocation_id)]] x_1_param : vec3<u32>) {
+ x_1 = bitcast<vec3<i32>>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm
new file mode 100644
index 0000000..9a6b2c6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_WorkGroupID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpAccessChain %_ptr_Input_v3uint %gl_WorkGroupID
+%2 = OpLoad %v3uint %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..737d636
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint3 x_1 = uint3(0u, 0u, 0u);
+
+void main_1() {
+ const uint3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_GroupID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.msl
new file mode 100644
index 0000000..7ccca66
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint3* const tint_symbol_2) {
+ uint3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[threadgroup_position_in_grid]]) {
+ thread uint3 tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..8cb0f37
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn WorkgroupId
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Private_v3uint = OpTypePointer Private %v3uint
+ %5 = OpConstantNull %v3uint
+ %x_1 = OpVariable %_ptr_Private_v3uint Private %5
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %v3uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %15 = OpLoad %v3uint %tint_symbol
+ OpStore %x_1 %15
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..c68c220
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : vec3<u32>;
+
+fn main_1() {
+ let x_2 : vec3<u32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(workgroup_id)]] x_1_param : vec3<u32>) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm
new file mode 100644
index 0000000..7d53f55
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_WorkGroupID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3int = OpTypePointer Input %v3int
+%gl_WorkGroupID = OpVariable %_ptr_Input_v3int Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpAccessChain %_ptr_Input_v3int %gl_WorkGroupID
+%2 = OpLoad %v3int %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.hlsl
new file mode 100644
index 0000000..8dfa375
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static int3 x_1 = int3(0, 0, 0);
+
+void main_1() {
+ const int3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_GroupID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.msl
new file mode 100644
index 0000000..6cee654
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int3* const tint_symbol_2) {
+ int3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[threadgroup_position_in_grid]]) {
+ thread int3 tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int3>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.spvasm
new file mode 100644
index 0000000..fbeffa5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn WorkgroupId
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+%_ptr_Private_v3int = OpTypePointer Private %v3int
+ %5 = OpConstantNull %v3int
+ %x_1 = OpVariable %_ptr_Private_v3int Private %5
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %14 = OpLoad %v3int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %16 = OpLabel
+ %18 = OpLoad %v3uint %tint_symbol
+ %17 = OpBitcast %v3int %18
+ OpStore %x_1 %17
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.wgsl
new file mode 100644
index 0000000..ef7e659
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : vec3<i32>;
+
+fn main_1() {
+ let x_2 : vec3<i32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(workgroup_id)]] x_1_param : vec3<u32>) {
+ x_1 = bitcast<vec3<i32>>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm
new file mode 100644
index 0000000..a5c4fab
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_LocalInvocationIndex
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpCopyObject %_ptr_Input_uint %gl_LocalInvocationIndex
+%2 = OpLoad %uint %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..f496a7d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint x_1 = 0u;
+
+void main_1() {
+ const uint x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_GroupIndex;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.msl
new file mode 100644
index 0000000..7e7cc9a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_2) {
+ uint const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint x_1_param [[thread_index_in_threadgroup]]) {
+ thread uint tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..9e443ff
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ %11 = OpLoad %uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %13 = OpLabel
+ %14 = OpLoad %uint %tint_symbol
+ OpStore %x_1 %14
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..768c1fa
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> x_1 : u32;
+
+fn main_1() {
+ let x_13 : ptr<private, u32> = &(x_1);
+ let x_2 : u32 = *(x_13);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(local_invocation_index)]] x_1_param : u32) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm
new file mode 100644
index 0000000..87a25a9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_LocalInvocationIndex
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_LocalInvocationIndex = OpVariable %_ptr_Input_int Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpCopyObject %_ptr_Input_int %gl_LocalInvocationIndex
+%2 = OpLoad %int %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..983314b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static int x_1 = 0;
+
+void main_1() {
+ const int x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_GroupIndex;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.msl
new file mode 100644
index 0000000..d6228c7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int* const tint_symbol_2) {
+ int const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint x_1_param [[thread_index_in_threadgroup]]) {
+ thread int tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..230fe6a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %4 = OpConstantNull %int
+ %x_1 = OpVariable %_ptr_Private_int Private %4
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %16 = OpLoad %uint %tint_symbol
+ %15 = OpBitcast %int %16
+ OpStore %x_1 %15
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..e96cecc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> x_1 : i32;
+
+fn main_1() {
+ let x_13 : ptr<private, i32> = &(x_1);
+ let x_2 : i32 = *(x_13);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(local_invocation_index)]] x_1_param : u32) {
+ x_1 = bitcast<i32>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm
new file mode 100644
index 0000000..a6ebede
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_LocalInvocationID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpCopyObject %_ptr_Input_v3uint %gl_LocalInvocationID
+%2 = OpLoad %v3uint %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..ab2e231
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint3 x_1 = uint3(0u, 0u, 0u);
+
+void main_1() {
+ const uint3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_GroupThreadID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.msl
new file mode 100644
index 0000000..b153c9e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint3* const tint_symbol_2) {
+ uint3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[thread_position_in_threadgroup]]) {
+ thread uint3 tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..9e60c0e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn LocalInvocationId
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Private_v3uint = OpTypePointer Private %v3uint
+ %5 = OpConstantNull %v3uint
+ %x_1 = OpVariable %_ptr_Private_v3uint Private %5
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %v3uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %15 = OpLoad %v3uint %tint_symbol
+ OpStore %x_1 %15
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..219224d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> x_1 : vec3<u32>;
+
+fn main_1() {
+ let x_13 : ptr<private, vec3<u32>> = &(x_1);
+ let x_2 : vec3<u32> = *(x_13);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(local_invocation_id)]] x_1_param : vec3<u32>) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm
new file mode 100644
index 0000000..0dceb7c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_LocalInvocationID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3int = OpTypePointer Input %v3int
+%gl_LocalInvocationID = OpVariable %_ptr_Input_v3int Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpCopyObject %_ptr_Input_v3int %gl_LocalInvocationID
+%2 = OpLoad %v3int %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..9b5b8cc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static int3 x_1 = int3(0, 0, 0);
+
+void main_1() {
+ const int3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_GroupThreadID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.msl
new file mode 100644
index 0000000..bdf373b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int3* const tint_symbol_2) {
+ int3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[thread_position_in_threadgroup]]) {
+ thread int3 tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int3>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..d489e17
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn LocalInvocationId
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+%_ptr_Private_v3int = OpTypePointer Private %v3int
+ %5 = OpConstantNull %v3int
+ %x_1 = OpVariable %_ptr_Private_v3int Private %5
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %14 = OpLoad %v3int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %16 = OpLabel
+ %18 = OpLoad %v3uint %tint_symbol
+ %17 = OpBitcast %v3int %18
+ OpStore %x_1 %17
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..c4a03f9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> x_1 : vec3<i32>;
+
+fn main_1() {
+ let x_13 : ptr<private, vec3<i32>> = &(x_1);
+ let x_2 : vec3<i32> = *(x_13);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(local_invocation_id)]] x_1_param : vec3<u32>) {
+ x_1 = bitcast<vec3<i32>>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm
new file mode 100644
index 0000000..f36df5a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_GlobalInvocationID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpCopyObject %_ptr_Input_v3uint %gl_GlobalInvocationID
+%2 = OpLoad %v3uint %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..1808399
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint3 x_1 = uint3(0u, 0u, 0u);
+
+void main_1() {
+ const uint3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_DispatchThreadID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.msl
new file mode 100644
index 0000000..b636006
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint3* const tint_symbol_2) {
+ uint3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[thread_position_in_grid]]) {
+ thread uint3 tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..aedb68e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn GlobalInvocationId
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Private_v3uint = OpTypePointer Private %v3uint
+ %5 = OpConstantNull %v3uint
+ %x_1 = OpVariable %_ptr_Private_v3uint Private %5
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %v3uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %15 = OpLoad %v3uint %tint_symbol
+ OpStore %x_1 %15
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..92c5c3b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> x_1 : vec3<u32>;
+
+fn main_1() {
+ let x_13 : ptr<private, vec3<u32>> = &(x_1);
+ let x_2 : vec3<u32> = *(x_13);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(global_invocation_id)]] x_1_param : vec3<u32>) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm
new file mode 100644
index 0000000..cc6e514
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_GlobalInvocationID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3int = OpTypePointer Input %v3int
+%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3int Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpCopyObject %_ptr_Input_v3int %gl_GlobalInvocationID
+%2 = OpLoad %v3int %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..4c89479
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static int3 x_1 = int3(0, 0, 0);
+
+void main_1() {
+ const int3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_DispatchThreadID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.msl
new file mode 100644
index 0000000..98f26ba
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int3* const tint_symbol_2) {
+ int3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[thread_position_in_grid]]) {
+ thread int3 tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int3>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..333a5bc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn GlobalInvocationId
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+%_ptr_Private_v3int = OpTypePointer Private %v3int
+ %5 = OpConstantNull %v3int
+ %x_1 = OpVariable %_ptr_Private_v3int Private %5
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %14 = OpLoad %v3int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %16 = OpLabel
+ %18 = OpLoad %v3uint %tint_symbol
+ %17 = OpBitcast %v3int %18
+ OpStore %x_1 %17
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..679d802
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> x_1 : vec3<i32>;
+
+fn main_1() {
+ let x_13 : ptr<private, vec3<i32>> = &(x_1);
+ let x_2 : vec3<i32> = *(x_13);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(global_invocation_id)]] x_1_param : vec3<u32>) {
+ x_1 = bitcast<vec3<i32>>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm
new file mode 100644
index 0000000..8ce8fba
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_WorkGroupID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpCopyObject %_ptr_Input_v3uint %gl_WorkGroupID
+%2 = OpLoad %v3uint %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..737d636
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint3 x_1 = uint3(0u, 0u, 0u);
+
+void main_1() {
+ const uint3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_GroupID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.msl
new file mode 100644
index 0000000..7ccca66
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint3* const tint_symbol_2) {
+ uint3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[threadgroup_position_in_grid]]) {
+ thread uint3 tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..8cb0f37
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn WorkgroupId
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Private_v3uint = OpTypePointer Private %v3uint
+ %5 = OpConstantNull %v3uint
+ %x_1 = OpVariable %_ptr_Private_v3uint Private %5
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %v3uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %15 = OpLoad %v3uint %tint_symbol
+ OpStore %x_1 %15
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..862a322
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> x_1 : vec3<u32>;
+
+fn main_1() {
+ let x_13 : ptr<private, vec3<u32>> = &(x_1);
+ let x_2 : vec3<u32> = *(x_13);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(workgroup_id)]] x_1_param : vec3<u32>) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm
new file mode 100644
index 0000000..a4a60d6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm
@@ -0,0 +1,27 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_WorkGroupID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3int = OpTypePointer Input %v3int
+%gl_WorkGroupID = OpVariable %_ptr_Input_v3int Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%13 = OpCopyObject %_ptr_Input_v3int %gl_WorkGroupID
+%2 = OpLoad %v3int %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.hlsl
new file mode 100644
index 0000000..8dfa375
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static int3 x_1 = int3(0, 0, 0);
+
+void main_1() {
+ const int3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_GroupID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.msl
new file mode 100644
index 0000000..6cee654
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int3* const tint_symbol_2) {
+ int3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[threadgroup_position_in_grid]]) {
+ thread int3 tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int3>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.spvasm
new file mode 100644
index 0000000..fbeffa5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn WorkgroupId
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+%_ptr_Private_v3int = OpTypePointer Private %v3int
+ %5 = OpConstantNull %v3int
+ %x_1 = OpVariable %_ptr_Private_v3int Private %5
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %14 = OpLoad %v3int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %16 = OpLabel
+ %18 = OpLoad %v3uint %tint_symbol
+ %17 = OpBitcast %v3int %18
+ OpStore %x_1 %17
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.wgsl
new file mode 100644
index 0000000..e60015a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> x_1 : vec3<i32>;
+
+fn main_1() {
+ let x_13 : ptr<private, vec3<i32>> = &(x_1);
+ let x_2 : vec3<i32> = *(x_13);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(workgroup_id)]] x_1_param : vec3<u32>) {
+ x_1 = bitcast<vec3<i32>>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm
new file mode 100644
index 0000000..7f312fe
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm
@@ -0,0 +1,26 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_LocalInvocationIndex
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%2 = OpLoad %uint %gl_LocalInvocationIndex
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..f496a7d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint x_1 = 0u;
+
+void main_1() {
+ const uint x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_GroupIndex;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.msl
new file mode 100644
index 0000000..7e7cc9a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_2) {
+ uint const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint x_1_param [[thread_index_in_threadgroup]]) {
+ thread uint tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..9e443ff
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ %11 = OpLoad %uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %13 = OpLabel
+ %14 = OpLoad %uint %tint_symbol
+ OpStore %x_1 %14
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..e877436
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : u32;
+
+fn main_1() {
+ let x_2 : u32 = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(local_invocation_index)]] x_1_param : u32) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm
new file mode 100644
index 0000000..13cb937
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm
@@ -0,0 +1,26 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_LocalInvocationIndex
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_LocalInvocationIndex = OpVariable %_ptr_Input_int Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%2 = OpLoad %int %gl_LocalInvocationIndex
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..983314b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static int x_1 = 0;
+
+void main_1() {
+ const int x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_GroupIndex;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.msl
new file mode 100644
index 0000000..d6228c7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int* const tint_symbol_2) {
+ int const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint x_1_param [[thread_index_in_threadgroup]]) {
+ thread int tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..230fe6a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn LocalInvocationIndex
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %4 = OpConstantNull %int
+ %x_1 = OpVariable %_ptr_Private_int Private %4
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %16 = OpLoad %uint %tint_symbol
+ %15 = OpBitcast %int %16
+ OpStore %x_1 %15
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..325c2c5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : i32;
+
+fn main_1() {
+ let x_2 : i32 = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(local_invocation_index)]] x_1_param : u32) {
+ x_1 = bitcast<i32>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm
new file mode 100644
index 0000000..9b6ef51
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm
@@ -0,0 +1,26 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_LocalInvocationID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%2 = OpLoad %v3uint %gl_LocalInvocationID
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..ab2e231
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint3 x_1 = uint3(0u, 0u, 0u);
+
+void main_1() {
+ const uint3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_GroupThreadID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.msl
new file mode 100644
index 0000000..b153c9e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint3* const tint_symbol_2) {
+ uint3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[thread_position_in_threadgroup]]) {
+ thread uint3 tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..9e60c0e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn LocalInvocationId
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Private_v3uint = OpTypePointer Private %v3uint
+ %5 = OpConstantNull %v3uint
+ %x_1 = OpVariable %_ptr_Private_v3uint Private %5
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %v3uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %15 = OpLoad %v3uint %tint_symbol
+ OpStore %x_1 %15
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..d287187
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : vec3<u32>;
+
+fn main_1() {
+ let x_2 : vec3<u32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(local_invocation_id)]] x_1_param : vec3<u32>) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm
new file mode 100644
index 0000000..fa9cae1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm
@@ -0,0 +1,26 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_LocalInvocationID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3int = OpTypePointer Input %v3int
+%gl_LocalInvocationID = OpVariable %_ptr_Input_v3int Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%2 = OpLoad %v3int %gl_LocalInvocationID
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..9b5b8cc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static int3 x_1 = int3(0, 0, 0);
+
+void main_1() {
+ const int3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_GroupThreadID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.msl
new file mode 100644
index 0000000..bdf373b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int3* const tint_symbol_2) {
+ int3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[thread_position_in_threadgroup]]) {
+ thread int3 tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int3>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..d489e17
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn LocalInvocationId
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+%_ptr_Private_v3int = OpTypePointer Private %v3int
+ %5 = OpConstantNull %v3int
+ %x_1 = OpVariable %_ptr_Private_v3int Private %5
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %14 = OpLoad %v3int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %16 = OpLabel
+ %18 = OpLoad %v3uint %tint_symbol
+ %17 = OpBitcast %v3int %18
+ OpStore %x_1 %17
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..d5f74d9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : vec3<i32>;
+
+fn main_1() {
+ let x_2 : vec3<i32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(local_invocation_id)]] x_1_param : vec3<u32>) {
+ x_1 = bitcast<vec3<i32>>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm
new file mode 100644
index 0000000..20a177f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm
@@ -0,0 +1,26 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_GlobalInvocationID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%2 = OpLoad %v3uint %gl_GlobalInvocationID
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..1808399
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint3 x_1 = uint3(0u, 0u, 0u);
+
+void main_1() {
+ const uint3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_DispatchThreadID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.msl
new file mode 100644
index 0000000..b636006
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint3* const tint_symbol_2) {
+ uint3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[thread_position_in_grid]]) {
+ thread uint3 tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..aedb68e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn GlobalInvocationId
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Private_v3uint = OpTypePointer Private %v3uint
+ %5 = OpConstantNull %v3uint
+ %x_1 = OpVariable %_ptr_Private_v3uint Private %5
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %v3uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %15 = OpLoad %v3uint %tint_symbol
+ OpStore %x_1 %15
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..eb4dd00
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : vec3<u32>;
+
+fn main_1() {
+ let x_2 : vec3<u32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(global_invocation_id)]] x_1_param : vec3<u32>) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm
new file mode 100644
index 0000000..c7c748a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm
@@ -0,0 +1,26 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_GlobalInvocationID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3int = OpTypePointer Input %v3int
+%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3int Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%2 = OpLoad %v3int %gl_GlobalInvocationID
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..4c89479
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static int3 x_1 = int3(0, 0, 0);
+
+void main_1() {
+ const int3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_DispatchThreadID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.msl
new file mode 100644
index 0000000..98f26ba
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int3* const tint_symbol_2) {
+ int3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[thread_position_in_grid]]) {
+ thread int3 tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int3>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..333a5bc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn GlobalInvocationId
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+%_ptr_Private_v3int = OpTypePointer Private %v3int
+ %5 = OpConstantNull %v3int
+ %x_1 = OpVariable %_ptr_Private_v3int Private %5
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %14 = OpLoad %v3int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %16 = OpLabel
+ %18 = OpLoad %v3uint %tint_symbol
+ %17 = OpBitcast %v3int %18
+ OpStore %x_1 %17
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..f57b424
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : vec3<i32>;
+
+fn main_1() {
+ let x_2 : vec3<i32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(global_invocation_id)]] x_1_param : vec3<u32>) {
+ x_1 = bitcast<vec3<i32>>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm
new file mode 100644
index 0000000..254864e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm
@@ -0,0 +1,26 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_WorkGroupID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%2 = OpLoad %v3uint %gl_WorkGroupID
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..737d636
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint3 x_1 = uint3(0u, 0u, 0u);
+
+void main_1() {
+ const uint3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_GroupID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.msl
new file mode 100644
index 0000000..7ccca66
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint3* const tint_symbol_2) {
+ uint3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[threadgroup_position_in_grid]]) {
+ thread uint3 tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..8cb0f37
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn WorkgroupId
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Private_v3uint = OpTypePointer Private %v3uint
+ %5 = OpConstantNull %v3uint
+ %x_1 = OpVariable %_ptr_Private_v3uint Private %5
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %v3uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %15 = OpLoad %v3uint %tint_symbol
+ OpStore %x_1 %15
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..c68c220
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : vec3<u32>;
+
+fn main_1() {
+ let x_2 : vec3<u32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(workgroup_id)]] x_1_param : vec3<u32>) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm
new file mode 100644
index 0000000..5e1b256
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm
@@ -0,0 +1,26 @@
+; Test: Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %3 "main" %gl_WorkGroupID
+OpExecutionMode %3 LocalSize 1 1 1
+OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%v3int = OpTypeVector %int 3
+%_ptr_Input_v3int = OpTypePointer Input %v3int
+%gl_WorkGroupID = OpVariable %_ptr_Input_v3int Input
+%3 = OpFunction %void None %5
+%12 = OpLabel
+%2 = OpLoad %v3int %gl_WorkGroupID
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.hlsl
new file mode 100644
index 0000000..8dfa375
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static int3 x_1 = int3(0, 0, 0);
+
+void main_1() {
+ const int3 x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint3 x_1_param : SV_GroupID;
+};
+
+[numthreads(1, 1, 1)]
+void main(tint_symbol_1 tint_symbol) {
+ const uint3 x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.msl
new file mode 100644
index 0000000..6cee654
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int3* const tint_symbol_2) {
+ int3 const x_2 = *(tint_symbol_2);
+ return;
+}
+
+kernel void tint_symbol(uint3 x_1_param [[threadgroup_position_in_grid]]) {
+ thread int3 tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int3>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.spvasm
new file mode 100644
index 0000000..fbeffa5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main" %tint_symbol
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn WorkgroupId
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+%_ptr_Private_v3int = OpTypePointer Private %v3int
+ %5 = OpConstantNull %v3int
+ %x_1 = OpVariable %_ptr_Private_v3int Private %5
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Input_v3uint = OpTypePointer Input %v3uint
+%tint_symbol = OpVariable %_ptr_Input_v3uint Input
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %14 = OpLoad %v3int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %16 = OpLabel
+ %18 = OpLoad %v3uint %tint_symbol
+ %17 = OpBitcast %v3int %18
+ OpStore %x_1 %17
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.wgsl
new file mode 100644
index 0000000..ef7e659
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : vec3<i32>;
+
+fn main_1() {
+ let x_2 : vec3<i32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main([[builtin(workgroup_id)]] x_1_param : vec3<u32>) {
+ x_1 = bitcast<vec3<i32>>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm
new file mode 100644
index 0000000..cc1ad60
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm
@@ -0,0 +1,145 @@
+; Test: Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 126
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 0
+OpDecorate %20 NonWritable
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%28 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%35 = OpConstantNull %v2float
+%36 = OpConstantNull %v3float
+%37 = OpConstantNull %v4float
+%38 = OpConstantComposite %v2int %int_1 %int_2
+%39 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%40 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%41 = OpConstantComposite %v2uint %uint_1 %uint_2
+%42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%43 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%44 = OpConstantComposite %v2float %float_1 %float_2
+%45 = OpConstantComposite %v2float %float_2 %float_1
+%46 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%49 = OpTypeSampler
+%50 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%51 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%53 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%55 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%56 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%58 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%59 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%61 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%62 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%63 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%65 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%67 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%68 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%70 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%71 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%73 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%74 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%75 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%77 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%79 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%80 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%82 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%83 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%85 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_49 = OpTypePointer UniformConstant %49
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%20 = OpVariable %_ptr_UniformConstant_58 UniformConstant
+%1 = OpFunction %void None %3
+%123 = OpLabel
+%124 = OpLoad %58 %20
+%125 = OpImageRead %v4float %124 %uint_1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..071b671
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+warning: use of deprecated intrinsic
+Texture1D<float4> x_20 : register(t0, space0);
+
+void main_1() {
+ const float4 x_125 = x_20.Load(int2(int(1u), 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.msl
new file mode 100644
index 0000000..7efcaaf
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.msl
@@ -0,0 +1,14 @@
+warning: use of deprecated intrinsic
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::read> tint_symbol_1) {
+ float4 const x_125 = tint_symbol_1.read(uint(int(1u)));
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::read> tint_symbol_2 [[texture(0)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..b6cb9e7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+warning: use of deprecated intrinsic
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 0
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %11 = OpLoad %3 %x_20
+ %9 = OpImageRead %v4float %11 %int_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..6339b4f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_0.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+warning: use of deprecated intrinsic
+[[group(0), binding(0)]] var x_20 : texture_storage_1d<rg32float, read>;
+
+fn main_1() {
+ let x_125 : vec4<f32> = textureLoad(x_20, i32(1u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm
new file mode 100644
index 0000000..2205dfa
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm
@@ -0,0 +1,145 @@
+; Test: Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 125
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 0
+OpDecorate %20 NonReadable
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%28 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%35 = OpConstantNull %v2float
+%36 = OpConstantNull %v3float
+%37 = OpConstantNull %v4float
+%38 = OpConstantComposite %v2int %int_1 %int_2
+%39 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%40 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%41 = OpConstantComposite %v2uint %uint_1 %uint_2
+%42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%43 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%44 = OpConstantComposite %v2float %float_1 %float_2
+%45 = OpConstantComposite %v2float %float_2 %float_1
+%46 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%49 = OpTypeSampler
+%50 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%51 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%53 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%55 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%56 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%58 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%59 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%61 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%62 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%63 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%65 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%67 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%68 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%70 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%71 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%73 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%74 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%75 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%77 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%79 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%80 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%82 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%83 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%85 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_49 = OpTypePointer UniformConstant %49
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%20 = OpVariable %_ptr_UniformConstant_58 UniformConstant
+%1 = OpFunction %void None %3
+%123 = OpLabel
+%124 = OpLoad %58 %20
+OpImageWrite %124 %uint_1 %37
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..8486152
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+RWTexture1D<float4> x_20 : register(u0, space0);
+
+void main_1() {
+ x_20[int(1u)] = float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.msl
new file mode 100644
index 0000000..c2a8c6d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f, 0.0f, 0.0f, 0.0f), uint(int(1u)));
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::write> tint_symbol_2 [[texture(0)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..950da1c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.spvasm
@@ -0,0 +1,39 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonReadable
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 0
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v4float = OpTypeVector %float 4
+ %float_0 = OpConstant %float 0
+ %15 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %10 = OpLoad %3 %x_20
+ OpImageWrite %10 %int_1 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..3a825ba
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+[[group(0), binding(0)]] var x_20 : texture_storage_1d<rg32float, write>;
+
+fn main_1() {
+ textureStore(x_20, i32(1u), vec4<f32>(0.0, 0.0, 0.0, 0.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm
new file mode 100644
index 0000000..5a58e6d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm
@@ -0,0 +1,144 @@
+; Test: Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 126
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 0
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%28 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%35 = OpConstantNull %v2float
+%36 = OpConstantNull %v3float
+%37 = OpConstantNull %v4float
+%38 = OpConstantComposite %v2int %int_1 %int_2
+%39 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%40 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%41 = OpConstantComposite %v2uint %uint_1 %uint_2
+%42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%43 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%44 = OpConstantComposite %v2float %float_1 %float_2
+%45 = OpConstantComposite %v2float %float_2 %float_1
+%46 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%49 = OpTypeSampler
+%50 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%51 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%53 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%55 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%56 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%58 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%59 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%61 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%62 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%63 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%65 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%67 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%68 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%70 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%71 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%73 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%74 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%75 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%77 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%79 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%80 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%82 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%83 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%85 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_49 = OpTypePointer UniformConstant %49
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%20 = OpVariable %_ptr_UniformConstant_50 UniformConstant
+%1 = OpFunction %void None %3
+%123 = OpLabel
+%124 = OpLoad %50 %20
+%125 = OpImageFetch %v4float %124 %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..e4acdba
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+Texture1D<float4> x_20 : register(t0, space0);
+
+void main_1() {
+ const float4 x_125 = x_20.Load(int2(int(0u), 0));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..67e007f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture1d<float, access::sample> tint_symbol_1) {
+ float4 const x_125 = tint_symbol_1.read(uint(int(0u)), 0);
+ return;
+}
+
+fragment void tint_symbol(texture1d<float, access::sample> tint_symbol_2 [[texture(0)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..ec825f0
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 0
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %11 = OpLoad %3 %x_20
+ %9 = OpImageFetch %v4float %11 %int_0 Lod %int_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..e6a759a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+[[group(0), binding(0)]] var x_20 : texture_1d<f32>;
+
+fn main_1() {
+ let x_125 : vec4<f32> = textureLoad(x_20, i32(0u), 0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm
new file mode 100644
index 0000000..01ed012
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm
@@ -0,0 +1,144 @@
+; Test: Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 126
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 0
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%28 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%35 = OpConstantNull %v2float
+%36 = OpConstantNull %v3float
+%37 = OpConstantNull %v4float
+%38 = OpConstantComposite %v2int %int_1 %int_2
+%39 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%40 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%41 = OpConstantComposite %v2uint %uint_1 %uint_2
+%42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%43 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%44 = OpConstantComposite %v2float %float_1 %float_2
+%45 = OpConstantComposite %v2float %float_2 %float_1
+%46 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%49 = OpTypeSampler
+%50 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%51 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%53 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%55 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%56 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%58 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%59 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%61 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%62 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%63 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%65 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%67 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%68 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%70 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%71 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%73 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%74 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%75 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%77 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%79 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%80 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%82 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%83 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%85 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_49 = OpTypePointer UniformConstant %49
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%20 = OpVariable %_ptr_UniformConstant_51 UniformConstant
+%1 = OpFunction %void None %3
+%123 = OpLabel
+%124 = OpLoad %51 %20
+%125 = OpImageQuerySizeLod %v2uint %124 %uint_1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..edb38d5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+Texture2D<float4> x_20 : register(t0, space0);
+
+void main_1() {
+ int3 tint_tmp;
+ x_20.GetDimensions(int(1u), tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const uint2 x_125 = uint2(tint_tmp.xy);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..cf03d78
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1) {
+ uint2 const x_125 = uint2(int2(tint_symbol_1.get_width(int(1u)), tint_symbol_1.get_height(int(1u))));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_2 [[texture(0)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..855359c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 0
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_1 = OpConstant %int 1
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %15 = OpLoad %3 %x_20
+ %12 = OpImageQuerySizeLod %v2int %15 %int_1
+ %9 = OpBitcast %v2uint %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..4029efe
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+[[group(0), binding(0)]] var x_20 : texture_2d<f32>;
+
+fn main_1() {
+ let x_125 : vec2<u32> = vec2<u32>(textureDimensions(x_20, i32(1u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm
new file mode 100644
index 0000000..9087dac
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm
@@ -0,0 +1,145 @@
+; Test: Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 126
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 0
+OpDecorate %20 NonWritable
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%28 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%35 = OpConstantNull %v2float
+%36 = OpConstantNull %v3float
+%37 = OpConstantNull %v4float
+%38 = OpConstantComposite %v2int %int_1 %int_2
+%39 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%40 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%41 = OpConstantComposite %v2uint %uint_1 %uint_2
+%42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%43 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%44 = OpConstantComposite %v2float %float_1 %float_2
+%45 = OpConstantComposite %v2float %float_2 %float_1
+%46 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%49 = OpTypeSampler
+%50 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%51 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%53 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%55 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%56 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%58 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%59 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%61 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%62 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%63 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%65 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%67 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%68 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%70 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%71 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%73 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%74 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%75 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%77 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%79 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%80 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%82 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%83 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%85 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_49 = OpTypePointer UniformConstant %49
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%20 = OpVariable %_ptr_UniformConstant_59 UniformConstant
+%1 = OpFunction %void None %3
+%123 = OpLabel
+%124 = OpLoad %59 %20
+%125 = OpImageQuerySize %v2uint %124
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..11ad13c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+Texture2D<float4> x_20 : register(t0, space0);
+
+void main_1() {
+ int2 tint_tmp;
+ x_20.GetDimensions(tint_tmp.x, tint_tmp.y);
+ const uint2 x_125 = uint2(tint_tmp);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.msl
new file mode 100644
index 0000000..cf24ad6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::read> tint_symbol_1) {
+ uint2 const x_125 = uint2(int2(tint_symbol_1.get_width(), tint_symbol_1.get_height()));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::read> tint_symbol_2 [[texture(0)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..5f31a30
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.spvasm
@@ -0,0 +1,39 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 NonWritable
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 0
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %15 = OpLoad %3 %x_20
+ %12 = OpImageQuerySize %v2int %15
+ %9 = OpBitcast %v2uint %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..b7e8c34
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+[[group(0), binding(0)]] var x_20 : texture_storage_2d<rg32float, read>;
+
+fn main_1() {
+ let x_125 : vec2<u32> = vec2<u32>(textureDimensions(x_20));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm
new file mode 100644
index 0000000..e69c921
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm
@@ -0,0 +1,144 @@
+; Test: Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 126
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 0
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%28 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%35 = OpConstantNull %v2float
+%36 = OpConstantNull %v3float
+%37 = OpConstantNull %v4float
+%38 = OpConstantComposite %v2int %int_1 %int_2
+%39 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%40 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%41 = OpConstantComposite %v2uint %uint_1 %uint_2
+%42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%43 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%44 = OpConstantComposite %v2float %float_1 %float_2
+%45 = OpConstantComposite %v2float %float_2 %float_1
+%46 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%49 = OpTypeSampler
+%50 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%51 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%53 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%55 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%56 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%58 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%59 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%61 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%62 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%63 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%65 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%67 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%68 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%70 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%71 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%73 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%74 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%75 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%77 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%79 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%80 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%82 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%83 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%85 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_49 = OpTypePointer UniformConstant %49
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%20 = OpVariable %_ptr_UniformConstant_51 UniformConstant
+%1 = OpFunction %void None %3
+%123 = OpLabel
+%124 = OpLoad %51 %20
+%125 = OpImageQueryLevels %uint %124
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..9abae08
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+Texture2D<float4> x_20 : register(t0, space0);
+
+void main_1() {
+ int3 tint_tmp;
+ x_20.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const uint x_125 = uint(tint_tmp.z);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.msl
new file mode 100644
index 0000000..cbbdada
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1) {
+ uint const x_125 = uint(int(tint_symbol_1.get_num_mip_levels()));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_2 [[texture(0)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..fcc8849
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 0
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %13 = OpLoad %3 %x_20
+ %11 = OpImageQueryLevels %int %13
+ %9 = OpBitcast %uint %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..3c794d7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+[[group(0), binding(0)]] var x_20 : texture_2d<f32>;
+
+fn main_1() {
+ let x_125 : u32 = u32(textureNumLevels(x_20));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm
new file mode 100644
index 0000000..746d8d9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm
@@ -0,0 +1,144 @@
+; Test: Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 126
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 0
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%28 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%35 = OpConstantNull %v2float
+%36 = OpConstantNull %v3float
+%37 = OpConstantNull %v4float
+%38 = OpConstantComposite %v2int %int_1 %int_2
+%39 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%40 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%41 = OpConstantComposite %v2uint %uint_1 %uint_2
+%42 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%43 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%44 = OpConstantComposite %v2float %float_1 %float_2
+%45 = OpConstantComposite %v2float %float_2 %float_1
+%46 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%47 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%49 = OpTypeSampler
+%50 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%51 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%53 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%55 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%56 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%58 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%59 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%61 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%62 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%63 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%65 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%67 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%68 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%70 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%71 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%73 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%74 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%75 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%77 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%79 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%80 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%82 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%83 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%85 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_49 = OpTypePointer UniformConstant %49
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%20 = OpVariable %_ptr_UniformConstant_52 UniformConstant
+%1 = OpFunction %void None %3
+%123 = OpLabel
+%124 = OpLoad %52 %20
+%125 = OpImageQuerySamples %uint %124
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..903865a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+Texture2DMS<float4> x_20 : register(t0, space0);
+
+void main_1() {
+ int3 tint_tmp;
+ x_20.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ const uint x_125 = uint(tint_tmp.z);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.msl
new file mode 100644
index 0000000..e9ec103
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d_ms<float, access::read> tint_symbol_1) {
+ uint const x_125 = uint(int(tint_symbol_1.get_num_samples()));
+ return;
+}
+
+fragment void tint_symbol(texture2d_ms<float, access::read> tint_symbol_2 [[texture(0)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..9ea81a1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 0
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_20 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %13 = OpLoad %3 %x_20
+ %11 = OpImageQuerySamples %int %13
+ %9 = OpBitcast %uint %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..9575cb5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+[[group(0), binding(0)]] var x_20 : texture_multisampled_2d<f32>;
+
+fn main_1() {
+ let x_125 : u32 = u32(textureNumSamples(x_20));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm
new file mode 100644
index 0000000..70480df
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm
@@ -0,0 +1,152 @@
+; Test: Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 132
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%29 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%36 = OpConstantNull %v2float
+%37 = OpConstantNull %v3float
+%38 = OpConstantNull %v4float
+%39 = OpConstantComposite %v2int %int_1 %int_2
+%40 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%41 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%42 = OpConstantComposite %v2uint %uint_1 %uint_2
+%43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%44 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%45 = OpConstantComposite %v2float %float_1 %float_2
+%46 = OpConstantComposite %v2float %float_2 %float_1
+%47 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%48 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%50 = OpTypeSampler
+%51 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%53 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%55 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%56 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%58 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%59 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%61 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%62 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%63 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%65 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%67 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%68 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%70 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%71 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%73 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%74 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%75 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%77 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%79 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%80 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%82 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%83 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%85 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%86 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%_ptr_UniformConstant_86 = OpTypePointer UniformConstant %86
+%124 = OpTypeSampledImage %52
+%125 = OpConstantNull %v2float
+%126 = OpConstantNull %v3float
+%10 = OpVariable %_ptr_UniformConstant_50 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_52 UniformConstant
+%1 = OpFunction %void None %3
+%127 = OpLabel
+%128 = OpLoad %50 %10
+%129 = OpLoad %52 %20
+%130 = OpSampledImage %124 %129 %128
+%131 = OpImageSampleImplicitLod %v4float %130 %125
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..c65283c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space0);
+
+void main_1() {
+ const float4 x_131 = x_20.Sample(x_10, float2(0.0f, 0.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.msl
new file mode 100644
index 0000000..2994e9c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float4 const x_131 = tint_symbol_1.sample(tint_symbol_2, float2(0.0f, 0.0f));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..e1bce55
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %16 = OpTypeSampledImage %6
+ %v2float = OpTypeVector %float 2
+ %float_0 = OpConstant %float 0
+ %20 = OpConstantComposite %v2float %float_0 %float_0
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %14 = OpLoad %3 %x_10
+ %15 = OpLoad %6 %x_20
+ %17 = OpSampledImage %16 %15 %14
+ %12 = OpImageSampleImplicitLod %v4float %17 %20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..a19e4a9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(0), binding(1)]] var x_20 : texture_2d<f32>;
+
+fn main_1() {
+ let x_131 : vec4<f32> = textureSample(x_20, x_10, vec2<f32>(0.0, 0.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm
new file mode 100644
index 0000000..63ea3fa
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm
@@ -0,0 +1,152 @@
+; Test: Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 132
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%29 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%36 = OpConstantNull %v2float
+%37 = OpConstantNull %v3float
+%38 = OpConstantNull %v4float
+%39 = OpConstantComposite %v2int %int_1 %int_2
+%40 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%41 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%42 = OpConstantComposite %v2uint %uint_1 %uint_2
+%43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%44 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%45 = OpConstantComposite %v2float %float_1 %float_2
+%46 = OpConstantComposite %v2float %float_2 %float_1
+%47 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%48 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%50 = OpTypeSampler
+%51 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%53 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%55 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%56 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%58 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%59 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%61 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%62 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%63 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%65 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%67 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%68 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%70 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%71 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%73 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%74 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%75 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%77 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%79 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%80 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%82 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%83 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%85 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%86 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%_ptr_UniformConstant_86 = OpTypePointer UniformConstant %86
+%124 = OpTypeSampledImage %52
+%125 = OpConstantNull %v2float
+%126 = OpConstantNull %v3float
+%10 = OpVariable %_ptr_UniformConstant_50 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_52 UniformConstant
+%1 = OpFunction %void None %3
+%127 = OpLabel
+%128 = OpLoad %50 %10
+%129 = OpLoad %52 %20
+%130 = OpSampledImage %124 %129 %128
+%131 = OpImageSampleExplicitLod %v4float %130 %125 Lod %29
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..a099f4c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+SamplerState x_10 : register(s0, space0);
+Texture2D<float4> x_20 : register(t1, space0);
+
+void main_1() {
+ const float4 x_131 = x_20.SampleLevel(x_10, float2(0.0f, 0.0f), 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.msl
new file mode 100644
index 0000000..72e2824
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float4 const x_131 = tint_symbol_1.sample(tint_symbol_2, float2(0.0f, 0.0f), level(0.0f));
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..3c11baf
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %16 = OpTypeSampledImage %6
+ %v2float = OpTypeVector %float 2
+ %float_0 = OpConstant %float 0
+ %20 = OpConstantComposite %v2float %float_0 %float_0
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %14 = OpLoad %3 %x_10
+ %15 = OpLoad %6 %x_20
+ %17 = OpSampledImage %16 %15 %14
+ %12 = OpImageSampleExplicitLod %v4float %17 %20 Lod %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..5e6d650
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(0), binding(1)]] var x_20 : texture_2d<f32>;
+
+fn main_1() {
+ let x_131 : vec4<f32> = textureSampleLevel(x_20, x_10, vec2<f32>(0.0, 0.0), 0.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm
new file mode 100644
index 0000000..a0aa50b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm
@@ -0,0 +1,152 @@
+; Test: Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 132
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%29 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%36 = OpConstantNull %v2float
+%37 = OpConstantNull %v3float
+%38 = OpConstantNull %v4float
+%39 = OpConstantComposite %v2int %int_1 %int_2
+%40 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%41 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%42 = OpConstantComposite %v2uint %uint_1 %uint_2
+%43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%44 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%45 = OpConstantComposite %v2float %float_1 %float_2
+%46 = OpConstantComposite %v2float %float_2 %float_1
+%47 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%48 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%50 = OpTypeSampler
+%51 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%53 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%55 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%56 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%58 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%59 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%61 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%62 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%63 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%65 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%67 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%68 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%70 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%71 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%73 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%74 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%75 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%77 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%79 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%80 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%82 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%83 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%85 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%86 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%_ptr_UniformConstant_86 = OpTypePointer UniformConstant %86
+%124 = OpTypeSampledImage %52
+%125 = OpConstantNull %v2float
+%126 = OpConstantNull %v3float
+%10 = OpVariable %_ptr_UniformConstant_50 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_52 UniformConstant
+%1 = OpFunction %void None %3
+%127 = OpLabel
+%128 = OpLoad %50 %10
+%129 = OpLoad %52 %20
+%130 = OpSampledImage %124 %129 %128
+%131 = OpImageSampleDrefImplicitLod %float %130 %125 %float_0_200000003
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..b780a17
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+SamplerComparisonState x_10 : register(s0, space0);
+Texture2D x_20 : register(t1, space0);
+
+void main_1() {
+ const float x_131 = x_20.SampleCmp(x_10, float2(0.0f, 0.0f), 0.200000003f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.msl
new file mode 100644
index 0000000..ab2c890
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float const x_131 = tint_symbol_1.sample_compare(tint_symbol_2, float2(0.0f, 0.0f), 0.200000003f);
+ return;
+}
+
+fragment void tint_symbol(depth2d<float, access::sample> tint_symbol_3 [[texture(1)]], sampler tint_symbol_4 [[sampler(0)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..973dbf7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 2D 1 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %15 = OpTypeSampledImage %6
+ %v2float = OpTypeVector %float 2
+ %float_0 = OpConstant %float 0
+ %19 = OpConstantComposite %v2float %float_0 %float_0
+%float_0_200000003 = OpConstant %float 0.200000003
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %13 = OpLoad %3 %x_10
+ %14 = OpLoad %6 %x_20
+ %16 = OpSampledImage %15 %14 %13
+ %12 = OpImageSampleDrefImplicitLod %float %16 %19 %float_0_200000003
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..b8630ae
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+[[group(0), binding(0)]] var x_10 : sampler_comparison;
+
+[[group(0), binding(1)]] var x_20 : texture_depth_2d;
+
+fn main_1() {
+ let x_131 : f32 = textureSampleCompare(x_20, x_10, vec2<f32>(0.0, 0.0), 0.200000003);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm
new file mode 100644
index 0000000..33c29ae
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %uint %2 PackSnorm4x8 %v4f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..f5d101b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.hlsl
@@ -0,0 +1,37 @@
+uint tint_pack4x8snorm(float4 param_0) {
+ int4 i = int4(round(clamp(param_0, -1.0, 1.0) * 127.0)) & 0xff;
+ return asuint(i.x | i.y << 8 | i.z << 16 | i.w << 24);
+}
+
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint x_1 = tint_pack4x8snorm(v4f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.msl
new file mode 100644
index 0000000..e11c628
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint const x_1 = pack_float_to_snorm4x8(v4f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..c9e44e8
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %uint %35 PackSnorm4x8 %33
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..e69479f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : u32 = pack4x8snorm(v4f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm
new file mode 100644
index 0000000..aa3b6f2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %uint %2 PackUnorm4x8 %v4f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..603ec91
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.hlsl
@@ -0,0 +1,37 @@
+uint tint_pack4x8unorm(float4 param_0) {
+ uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0));
+ return (i.x | i.y << 8 | i.z << 16 | i.w << 24);
+}
+
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint x_1 = tint_pack4x8unorm(v4f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.msl
new file mode 100644
index 0000000..71bfdcf
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint const x_1 = pack_float_to_unorm4x8(v4f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..f35a829
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %uint %35 PackUnorm4x8 %33
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..fbe54ff
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : u32 = pack4x8unorm(v4f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm
new file mode 100644
index 0000000..42e3c37
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %uint %2 PackSnorm2x16 %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..bb71e73
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.hlsl
@@ -0,0 +1,37 @@
+uint tint_pack2x16snorm(float2 param_0) {
+ int2 i = int2(round(clamp(param_0, -1.0, 1.0) * 32767.0)) & 0xffff;
+ return asuint(i.x | i.y << 16);
+}
+
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint x_1 = tint_pack2x16snorm(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.msl
new file mode 100644
index 0000000..314fb7c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint const x_1 = pack_float_to_snorm2x16(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..f9adb2b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %uint %35 PackSnorm2x16 %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..3c03ebe
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : u32 = pack2x16snorm(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm
new file mode 100644
index 0000000..a10a656
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %uint %2 PackUnorm2x16 %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..602213c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.hlsl
@@ -0,0 +1,37 @@
+uint tint_pack2x16unorm(float2 param_0) {
+ uint2 i = uint2(round(clamp(param_0, 0.0, 1.0) * 65535.0));
+ return (i.x | i.y << 16);
+}
+
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint x_1 = tint_pack2x16unorm(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.msl
new file mode 100644
index 0000000..4fd5294
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint const x_1 = pack_float_to_unorm2x16(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..cec3063
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %uint %35 PackUnorm2x16 %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..2fb416b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : u32 = pack2x16unorm(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm
new file mode 100644
index 0000000..9aeeb28
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %uint %2 PackHalf2x16 %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..b7cb4e5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.hlsl
@@ -0,0 +1,37 @@
+uint tint_pack2x16float(float2 param_0) {
+ uint2 i = f32tof16(param_0);
+ return i.x | (i.y << 16);
+}
+
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint x_1 = tint_pack2x16float(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.msl
new file mode 100644
index 0000000..2326c08
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint const x_1 = as_type<uint>(half2(v2f1));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..697a638
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %uint %35 PackHalf2x16 %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..80383a4
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : u32 = pack2x16float(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm
new file mode 100644
index 0000000..4f44266
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v4float %2 UnpackSnorm4x8 %u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..119835a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.hlsl
@@ -0,0 +1,38 @@
+float4 tint_unpack4x8snorm(uint param_0) {
+ int j = int(param_0);
+ int4 i = int4(j << 24, j << 16, j << 8, j) >> 24;
+ return clamp(float4(i) / 127.0, -1.0, 1.0);
+}
+
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float4 x_1 = tint_unpack4x8snorm(u1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.msl
new file mode 100644
index 0000000..3db4e59
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float4 const x_1 = unpack_snorm4x8_to_float(u1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..87fd429
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v4float %35 UnpackSnorm4x8 %uint_10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..802d8c9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec4<f32> = unpack4x8snorm(u1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm
new file mode 100644
index 0000000..490f159
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v4float %2 UnpackUnorm4x8 %u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..ae9fc1c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.hlsl
@@ -0,0 +1,38 @@
+float4 tint_unpack4x8unorm(uint param_0) {
+ uint j = param_0;
+ uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24);
+ return float4(i) / 255.0;
+}
+
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float4 x_1 = tint_unpack4x8unorm(u1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.msl
new file mode 100644
index 0000000..17fdac6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float4 const x_1 = unpack_unorm4x8_to_float(u1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..2a9d4ce
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v4float %35 UnpackUnorm4x8 %uint_10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..6fcb6a9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec4<f32> = unpack4x8unorm(u1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm
new file mode 100644
index 0000000..a8ba407
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 UnpackSnorm2x16 %u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..bc0d022
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.hlsl
@@ -0,0 +1,38 @@
+float2 tint_unpack2x16snorm(uint param_0) {
+ int j = int(param_0);
+ int2 i = int2(j << 16, j) >> 16;
+ return clamp(float2(i) / 32767.0, -1.0, 1.0);
+}
+
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = tint_unpack2x16snorm(u1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.msl
new file mode 100644
index 0000000..cbcf5eb
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = unpack_snorm2x16_to_float(u1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..441d49c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 UnpackSnorm2x16 %uint_10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..c6677a5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = unpack2x16snorm(u1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm
new file mode 100644
index 0000000..f9a9fc5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 UnpackUnorm2x16 %u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..4f72aff
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.hlsl
@@ -0,0 +1,38 @@
+float2 tint_unpack2x16unorm(uint param_0) {
+ uint j = param_0;
+ uint2 i = uint2(j & 0xffff, j >> 16);
+ return float2(i) / 65535.0;
+}
+
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = tint_unpack2x16unorm(u1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.msl
new file mode 100644
index 0000000..11a05dd
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = unpack_unorm2x16_to_float(u1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..9a062b9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 UnpackUnorm2x16 %uint_10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..a4b1e14
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = unpack2x16unorm(u1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm
new file mode 100644
index 0000000..6a35e2c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 UnpackHalf2x16 %u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..4e67d7d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.hlsl
@@ -0,0 +1,37 @@
+float2 tint_unpack2x16float(uint param_0) {
+ uint i = param_0;
+ return f16tof32(uint2(i & 0xffff, i >> 16));
+}
+
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = tint_unpack2x16float(u1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.msl
new file mode 100644
index 0000000..a56289b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = float2(as_type<half2>(u1));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..8cc47a8
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 UnpackHalf2x16 %uint_10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..f1b3b1f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = unpack2x16float(u1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm
new file mode 100644
index 0000000..ba524e8
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v3float %2 Cross %v3f1 %v3f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..5eb9727
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float3 x_1 = cross(v3f1, v3f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.msl
new file mode 100644
index 0000000..d05ff1f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float3 const x_1 = cross(v3f1, v3f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..67ec16b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v3float %35 Cross %30 %31
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..794ced9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec3<f32> = cross(v3f1, v3f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm
new file mode 100644
index 0000000..46bcd39
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Distance %f1 %f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..ee7e7da
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = distance(f1, f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.msl
new file mode 100644
index 0000000..238245e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = fabs(f1 - f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..3ce85f1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Distance %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..6b350f0
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = distance(f1, f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm
new file mode 100644
index 0000000..292f3e8
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Distance %v2f1 %v2f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..26bb202
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = distance(v2f1, v2f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.msl
new file mode 100644
index 0000000..093539e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = distance(v2f1, v2f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..1d4adf4
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Distance %26 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..a0f52d6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = distance(v2f1, v2f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm
new file mode 100644
index 0000000..e59693c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Length %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..a8f6e4a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = length(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.msl
new file mode 100644
index 0000000..4ac5f38
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = fabs(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..05663ec
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Length %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..79afbe1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = length(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm
new file mode 100644
index 0000000..a7e6873
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Length %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..167d0d8
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = length(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.msl
new file mode 100644
index 0000000..0b9b36d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = length(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..2306f2d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Length %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..b0351b5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = length(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm
new file mode 100644
index 0000000..8c19bda
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 NClamp %f1 %f2 %f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..eeae052
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = clamp(f1, f2, f3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.msl
new file mode 100644
index 0000000..401988b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = clamp(f1, f2, f3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..d5b56f1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 NClamp %float_50 %float_60 %float_70
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..2c8272f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = clamp(f1, f2, f3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm
new file mode 100644
index 0000000..bb606fa
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 FClamp %f1 %f2 %f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..eeae052
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = clamp(f1, f2, f3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.msl
new file mode 100644
index 0000000..401988b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = clamp(f1, f2, f3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..d5b56f1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 NClamp %float_50 %float_60 %float_70
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..2c8272f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = clamp(f1, f2, f3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm
new file mode 100644
index 0000000..3221f4b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Fma %f1 %f2 %f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..d2234d1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = mad(f1, f2, f3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.msl
new file mode 100644
index 0000000..007fa77
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = fma(f1, f2, f3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..aa0d13c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Fma %float_50 %float_60 %float_70
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..d4cb313
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = fma(f1, f2, f3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm
new file mode 100644
index 0000000..e4feec8
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 FMix %f1 %f2 %f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..6281d7d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = lerp(f1, f2, f3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.msl
new file mode 100644
index 0000000..a704b23
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = mix(f1, f2, f3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..a75d944
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 FMix %float_50 %float_60 %float_70
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..0c904b8
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = mix(f1, f2, f3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm
new file mode 100644
index 0000000..5ac4bba
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 SmoothStep %f1 %f2 %f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..31d3f7f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = smoothstep(f1, f2, f3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.msl
new file mode 100644
index 0000000..6f931cd
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = smoothstep(f1, f2, f3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..38c9cc0
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 SmoothStep %float_50 %float_60 %float_70
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..3888f75
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = smoothStep(f1, f2, f3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm
new file mode 100644
index 0000000..5b9c2b9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 NClamp %v2f1 %v2f2 %v2f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..f06a436
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = clamp(v2f1, v2f2, v2f3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.msl
new file mode 100644
index 0000000..1683450
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = clamp(v2f1, v2f2, v2f3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..ec15f9f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 NClamp %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..a0890eb
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = clamp(v2f1, v2f2, v2f3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm
new file mode 100644
index 0000000..80748fc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 FClamp %v2f1 %v2f2 %v2f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..f06a436
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = clamp(v2f1, v2f2, v2f3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.msl
new file mode 100644
index 0000000..1683450
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = clamp(v2f1, v2f2, v2f3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..ec15f9f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 NClamp %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..a0890eb
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = clamp(v2f1, v2f2, v2f3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm
new file mode 100644
index 0000000..96ad300
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Fma %v2f1 %v2f2 %v2f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..8bf6534
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = mad(v2f1, v2f2, v2f3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.msl
new file mode 100644
index 0000000..a622bcb
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = fma(v2f1, v2f2, v2f3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..0b93ffd
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Fma %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..5d16362
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = fma(v2f1, v2f2, v2f3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm
new file mode 100644
index 0000000..ec10088
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 FMix %v2f1 %v2f2 %v2f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..5e0fe7b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = lerp(v2f1, v2f2, v2f3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.msl
new file mode 100644
index 0000000..323a427
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = mix(v2f1, v2f2, v2f3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..0c07d32
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 FMix %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..6d2e82e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = mix(v2f1, v2f2, v2f3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm
new file mode 100644
index 0000000..25ae8eb
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 SmoothStep %v2f1 %v2f2 %v2f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..a65e391
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = smoothstep(v2f1, v2f2, v2f3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.msl
new file mode 100644
index 0000000..546d4d6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = smoothstep(v2f1, v2f2, v2f3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..c4062ba
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 SmoothStep %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..66a46c5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = smoothStep(v2f1, v2f2, v2f3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm
new file mode 100644
index 0000000..043d37b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Atan2 %f1 %f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..2337025
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = atan2(f1, f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.msl
new file mode 100644
index 0000000..8fb8a80
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = atan2(f1, f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..8d1f6d7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Atan2 %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..f98852d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = atan2(f1, f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm
new file mode 100644
index 0000000..4e00534
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 NMax %f1 %f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..b336ec5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = max(f1, f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.msl
new file mode 100644
index 0000000..ac90c5f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = fmax(f1, f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..1dfa7a6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 NMax %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..add72a2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = max(f1, f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm
new file mode 100644
index 0000000..743c005
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 NMin %f1 %f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..795e9ba
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = min(f1, f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.msl
new file mode 100644
index 0000000..eaaa317
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = fmin(f1, f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..8cf51cb
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 NMin %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..91dbf8e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = min(f1, f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm
new file mode 100644
index 0000000..402a596
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 FMax %f1 %f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..b336ec5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = max(f1, f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.msl
new file mode 100644
index 0000000..ac90c5f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = fmax(f1, f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..1dfa7a6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 NMax %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..add72a2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = max(f1, f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm
new file mode 100644
index 0000000..d00edc2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 FMin %f1 %f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..795e9ba
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = min(f1, f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.msl
new file mode 100644
index 0000000..eaaa317
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = fmin(f1, f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..8cf51cb
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 NMin %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..91dbf8e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = min(f1, f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm
new file mode 100644
index 0000000..a668d30
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Pow %f1 %f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..d637bbc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = pow(f1, f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.msl
new file mode 100644
index 0000000..f243db3
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = pow(f1, f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..723f920
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Pow %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..0e1f2ab
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = pow(f1, f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm
new file mode 100644
index 0000000..b408d16
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Step %f1 %f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..2b9bea6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = step(f1, f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.msl
new file mode 100644
index 0000000..5d51e76
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = step(f1, f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..c2f07fe
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Step %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..4c5a1b5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = step(f1, f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm
new file mode 100644
index 0000000..951c786
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Atan2 %v2f1 %v2f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..e3cc1fe
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = atan2(v2f1, v2f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.msl
new file mode 100644
index 0000000..a380d9c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = atan2(v2f1, v2f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..908222e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Atan2 %26 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..30dff65
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = atan2(v2f1, v2f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm
new file mode 100644
index 0000000..8ddd293
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 NMax %v2f1 %v2f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..ba378fd
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = max(v2f1, v2f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.msl
new file mode 100644
index 0000000..e197300
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = fmax(v2f1, v2f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..a6309d5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 NMax %26 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..4b34831
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = max(v2f1, v2f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm
new file mode 100644
index 0000000..f01ad2a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 NMin %v2f1 %v2f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..95069c1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = min(v2f1, v2f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.msl
new file mode 100644
index 0000000..d23ae08
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = fmin(v2f1, v2f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..2692f6f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 NMin %26 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..816369d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = min(v2f1, v2f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm
new file mode 100644
index 0000000..ef164eb
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 FMax %v2f1 %v2f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..ba378fd
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = max(v2f1, v2f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.msl
new file mode 100644
index 0000000..e197300
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = fmax(v2f1, v2f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..a6309d5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 NMax %26 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..4b34831
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = max(v2f1, v2f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm
new file mode 100644
index 0000000..47798a0
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 FMin %v2f1 %v2f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..95069c1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = min(v2f1, v2f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.msl
new file mode 100644
index 0000000..d23ae08
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = fmin(v2f1, v2f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..2692f6f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 NMin %26 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..816369d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = min(v2f1, v2f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm
new file mode 100644
index 0000000..1d715c5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Pow %v2f1 %v2f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..c99efcf
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = pow(v2f1, v2f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.msl
new file mode 100644
index 0000000..ec149a3
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = pow(v2f1, v2f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..01b2669
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Pow %26 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..14c8c1d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = pow(v2f1, v2f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm
new file mode 100644
index 0000000..fdb8a46
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Step %v2f1 %v2f2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..6dd1cc8
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = step(v2f1, v2f2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.msl
new file mode 100644
index 0000000..999dc50
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = step(v2f1, v2f2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..687e3b0
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Step %26 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..cf8872b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = step(v2f1, v2f2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm
new file mode 100644
index 0000000..20493e8
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Ldexp %f1 %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..876d281
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = ldexp(f1, i1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.msl
new file mode 100644
index 0000000..56622e8
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = ldexp(f1, i1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..28f401d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Ldexp %float_50 %int_30
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..6a6e445
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = ldexp(f1, i1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm
new file mode 100644
index 0000000..c417c1b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Ldexp %v2f1 %v2i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..49d65b9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = ldexp(v2f1, v2i1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.msl
new file mode 100644
index 0000000..7f4b918
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = ldexp(v2f1, v2i1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..13c02b5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Ldexp %26 %22
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..70e623e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = ldexp(v2f1, v2i1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm
new file mode 100644
index 0000000..326ffa2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Ldexp %f1 %u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..a889e78
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = ldexp(f1, int(u1));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.msl
new file mode 100644
index 0000000..9484dda
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = ldexp(f1, int(u1));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..2eab6d4
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %36 = OpBitcast %int %uint_10
+ %34 = OpExtInst %float %35 Ldexp %float_50 %36
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..45e0784
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = ldexp(f1, i32(u1));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm
new file mode 100644
index 0000000..03cbec2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Ldexp %v2f1 %v2u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..8968843
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = ldexp(v2f1, int2(v2u1));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.msl
new file mode 100644
index 0000000..937bf3d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = ldexp(v2f1, int2(v2u1));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..69e8594
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %36 = OpBitcast %v2int %18
+ %34 = OpExtInst %v2float %35 Ldexp %26 %36
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..100a2a9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = ldexp(v2f1, vec2<i32>(v2u1));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm
new file mode 100644
index 0000000..644826c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Acos %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..505499f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = acos(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.msl
new file mode 100644
index 0000000..532fd4e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = acos(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..1f36b25
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Acos %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..8dc2477
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = acos(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm
new file mode 100644
index 0000000..2154a08
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Asin %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..c49973b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = asin(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.msl
new file mode 100644
index 0000000..13e07e7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = asin(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..c9db4ff
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Asin %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..50556c9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = asin(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm
new file mode 100644
index 0000000..aacff86
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Floor %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.hlsl
new file mode 100644
index 0000000..5851103
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = floor(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.msl
new file mode 100644
index 0000000..48e0ad9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = floor(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.spvasm
new file mode 100644
index 0000000..9c27eb9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Floor %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.wgsl
new file mode 100644
index 0000000..5db5f20
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = floor(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm
new file mode 100644
index 0000000..5a71d53
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Fract %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.hlsl
new file mode 100644
index 0000000..ef9bbc9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = frac(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.msl
new file mode 100644
index 0000000..07959950
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = fract(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.spvasm
new file mode 100644
index 0000000..b95a0db
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Fract %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.wgsl
new file mode 100644
index 0000000..2d34c5c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = fract(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm
new file mode 100644
index 0000000..805437c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 InverseSqrt %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.hlsl
new file mode 100644
index 0000000..9b022fe
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = rsqrt(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.msl
new file mode 100644
index 0000000..c7910f2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = rsqrt(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.spvasm
new file mode 100644
index 0000000..6b6df66
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 InverseSqrt %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.wgsl
new file mode 100644
index 0000000..ab280a6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = inverseSqrt(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm
new file mode 100644
index 0000000..57d8fda
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Log %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.hlsl
new file mode 100644
index 0000000..e2f4cbe
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = log(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.msl
new file mode 100644
index 0000000..9c67337
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = log(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.spvasm
new file mode 100644
index 0000000..0e6037c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Log %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.wgsl
new file mode 100644
index 0000000..0223a9e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = log(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm
new file mode 100644
index 0000000..9dba2c6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Log2 %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.hlsl
new file mode 100644
index 0000000..ac39225
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = log2(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.msl
new file mode 100644
index 0000000..a2c3822
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = log2(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.spvasm
new file mode 100644
index 0000000..7f8fc7c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Log2 %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.wgsl
new file mode 100644
index 0000000..07aa82b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = log2(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm
new file mode 100644
index 0000000..48594ed
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Round %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.hlsl
new file mode 100644
index 0000000..4b2ecb1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = round(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.msl
new file mode 100644
index 0000000..1a37151
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = rint(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.spvasm
new file mode 100644
index 0000000..06f3802
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 RoundEven %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.wgsl
new file mode 100644
index 0000000..24859ef
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = round(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm
new file mode 100644
index 0000000..32d0776
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 RoundEven %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.hlsl
new file mode 100644
index 0000000..4b2ecb1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = round(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.msl
new file mode 100644
index 0000000..1a37151
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = rint(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.spvasm
new file mode 100644
index 0000000..06f3802
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 RoundEven %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.wgsl
new file mode 100644
index 0000000..24859ef
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = round(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm
new file mode 100644
index 0000000..487388c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Sin %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.hlsl
new file mode 100644
index 0000000..95a2b2c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = sin(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.msl
new file mode 100644
index 0000000..4a19e7c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = sin(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.spvasm
new file mode 100644
index 0000000..5d27967
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Sin %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.wgsl
new file mode 100644
index 0000000..090ba0e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = sin(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm
new file mode 100644
index 0000000..74aa8e5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Sinh %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.hlsl
new file mode 100644
index 0000000..2a30ec3
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = sinh(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.msl
new file mode 100644
index 0000000..ab34002
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = sinh(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.spvasm
new file mode 100644
index 0000000..f6b5725
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Sinh %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.wgsl
new file mode 100644
index 0000000..6038ab1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = sinh(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm
new file mode 100644
index 0000000..0594ace
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Sqrt %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad23fb5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = sqrt(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.msl
new file mode 100644
index 0000000..58cca00
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = sqrt(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.spvasm
new file mode 100644
index 0000000..73900b4
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Sqrt %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.wgsl
new file mode 100644
index 0000000..f6b726f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = sqrt(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm
new file mode 100644
index 0000000..60e094f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Atan %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..4c441f5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = atan(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.msl
new file mode 100644
index 0000000..a34ad6e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = atan(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..aa4a093
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Atan %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..8afd315
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = atan(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm
new file mode 100644
index 0000000..95f49c1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Tan %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.hlsl
new file mode 100644
index 0000000..b50f17c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = tan(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.msl
new file mode 100644
index 0000000..c0266db
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = tan(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.spvasm
new file mode 100644
index 0000000..fef4710
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Tan %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.wgsl
new file mode 100644
index 0000000..37c4b39
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = tan(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm
new file mode 100644
index 0000000..3fe84b3
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Tanh %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.hlsl
new file mode 100644
index 0000000..e558c37
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = tanh(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.msl
new file mode 100644
index 0000000..134e6a5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = tanh(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.spvasm
new file mode 100644
index 0000000..19d1f47
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Tanh %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.wgsl
new file mode 100644
index 0000000..b4ae346
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = tanh(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm
new file mode 100644
index 0000000..539da88
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Trunc %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.hlsl
new file mode 100644
index 0000000..4562c25
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = trunc(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.msl
new file mode 100644
index 0000000..8c80b00
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = trunc(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.spvasm
new file mode 100644
index 0000000..ec22dae
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Trunc %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.wgsl
new file mode 100644
index 0000000..5bfb997
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = trunc(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm
new file mode 100644
index 0000000..5671bac
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Ceil %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..a3321b9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = ceil(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.msl
new file mode 100644
index 0000000..4d42251
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = ceil(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..731cfb5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Ceil %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..be4ceb2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = ceil(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm
new file mode 100644
index 0000000..6cf28da
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Cos %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..02eb11a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = cos(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.msl
new file mode 100644
index 0000000..b22344f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = cos(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..60c2705
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Cos %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..ca8637c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = cos(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm
new file mode 100644
index 0000000..e394bd7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Cosh %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..71470f4
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = cosh(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.msl
new file mode 100644
index 0000000..c4dcb4e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = cosh(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..c70835d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Cosh %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..802e5d3
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = cosh(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm
new file mode 100644
index 0000000..5a08061
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Exp %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..26092f7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = exp(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.msl
new file mode 100644
index 0000000..2e89ac4
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = exp(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..47c6f20
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Exp %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..bf702a3
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = exp(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm
new file mode 100644
index 0000000..92daf76
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Exp2 %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.hlsl
new file mode 100644
index 0000000..5f2e11a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = exp2(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.msl
new file mode 100644
index 0000000..e31b33f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = exp2(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.spvasm
new file mode 100644
index 0000000..41553ce
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 Exp2 %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.wgsl
new file mode 100644
index 0000000..82a960a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = exp2(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm
new file mode 100644
index 0000000..510d71c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 FAbs %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.hlsl
new file mode 100644
index 0000000..4900be4
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = abs(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.msl
new file mode 100644
index 0000000..4ac5f38
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = fabs(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.spvasm
new file mode 100644
index 0000000..e78343c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 FAbs %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.wgsl
new file mode 100644
index 0000000..7589973
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = abs(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm
new file mode 100644
index 0000000..8920102
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 FSign %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.hlsl
new file mode 100644
index 0000000..f1df3b7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = sign(f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.msl
new file mode 100644
index 0000000..44f8245
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = sign(f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.spvasm
new file mode 100644
index 0000000..26bd845
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %float %35 FSign %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.wgsl
new file mode 100644
index 0000000..70f3873
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = sign(f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm
new file mode 100644
index 0000000..cf079c5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Acos %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..321b64c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = acos(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.msl
new file mode 100644
index 0000000..0c9a877
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = acos(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..a7d7194
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Acos %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..deac856
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = acos(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm
new file mode 100644
index 0000000..c39a977
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Asin %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..1a80112
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = asin(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.msl
new file mode 100644
index 0000000..01ab346
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = asin(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..0664b10
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Asin %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..358bdd6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = asin(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm
new file mode 100644
index 0000000..fe04d87
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Floor %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.hlsl
new file mode 100644
index 0000000..a080366
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = floor(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.msl
new file mode 100644
index 0000000..eb9416f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = floor(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.spvasm
new file mode 100644
index 0000000..aa27ff4
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Floor %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.wgsl
new file mode 100644
index 0000000..91cfb3d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = floor(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm
new file mode 100644
index 0000000..6839dec
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Fract %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.hlsl
new file mode 100644
index 0000000..d4b6ff7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = frac(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.msl
new file mode 100644
index 0000000..b179f70
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = fract(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.spvasm
new file mode 100644
index 0000000..b4b13ee
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Fract %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.wgsl
new file mode 100644
index 0000000..2e14f76
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = fract(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm
new file mode 100644
index 0000000..3c14e2b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 InverseSqrt %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.hlsl
new file mode 100644
index 0000000..47fe07f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = rsqrt(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.msl
new file mode 100644
index 0000000..99db3c2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = rsqrt(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.spvasm
new file mode 100644
index 0000000..f87d3ab
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 InverseSqrt %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.wgsl
new file mode 100644
index 0000000..177941e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = inverseSqrt(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm
new file mode 100644
index 0000000..638ad92
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Log %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.hlsl
new file mode 100644
index 0000000..d51a664
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = log(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.msl
new file mode 100644
index 0000000..9c033ad
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = log(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.spvasm
new file mode 100644
index 0000000..0ea92cc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Log %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.wgsl
new file mode 100644
index 0000000..b136a0f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = log(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm
new file mode 100644
index 0000000..28bb4da
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Log2 %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.hlsl
new file mode 100644
index 0000000..b4f49f6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = log2(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.msl
new file mode 100644
index 0000000..eab849b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = log2(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.spvasm
new file mode 100644
index 0000000..68a5d865
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Log2 %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.wgsl
new file mode 100644
index 0000000..6adbf96
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = log2(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm
new file mode 100644
index 0000000..ac99496
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Round %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.hlsl
new file mode 100644
index 0000000..b33a1bb
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = round(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.msl
new file mode 100644
index 0000000..51d1956
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = rint(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.spvasm
new file mode 100644
index 0000000..87c4d05
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 RoundEven %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.wgsl
new file mode 100644
index 0000000..d2f6d19
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = round(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm
new file mode 100644
index 0000000..3ca868a
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 RoundEven %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.hlsl
new file mode 100644
index 0000000..b33a1bb
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = round(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.msl
new file mode 100644
index 0000000..51d1956
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = rint(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.spvasm
new file mode 100644
index 0000000..87c4d05
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 RoundEven %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.wgsl
new file mode 100644
index 0000000..d2f6d19
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = round(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm
new file mode 100644
index 0000000..9b34c16
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Sin %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.hlsl
new file mode 100644
index 0000000..1c67f46
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = sin(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.msl
new file mode 100644
index 0000000..4cc0ef1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = sin(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.spvasm
new file mode 100644
index 0000000..7f5e16d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Sin %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.wgsl
new file mode 100644
index 0000000..bdea50d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = sin(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm
new file mode 100644
index 0000000..c6901db
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Sinh %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.hlsl
new file mode 100644
index 0000000..44a46d2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = sinh(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.msl
new file mode 100644
index 0000000..34c9fbd
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = sinh(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.spvasm
new file mode 100644
index 0000000..16386c1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Sinh %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.wgsl
new file mode 100644
index 0000000..2910d47
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = sinh(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm
new file mode 100644
index 0000000..04e250e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Sqrt %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.hlsl
new file mode 100644
index 0000000..ff291e1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = sqrt(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.msl
new file mode 100644
index 0000000..0610770
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = sqrt(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.spvasm
new file mode 100644
index 0000000..ce4e5b5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Sqrt %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.wgsl
new file mode 100644
index 0000000..1b87cef
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = sqrt(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm
new file mode 100644
index 0000000..89ca946
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Atan %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..c358e0c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = atan(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.msl
new file mode 100644
index 0000000..b8e0ca6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = atan(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..90c23c5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Atan %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..e3b1d27
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = atan(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm
new file mode 100644
index 0000000..da18246
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Tan %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.hlsl
new file mode 100644
index 0000000..07771f1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = tan(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.msl
new file mode 100644
index 0000000..4c361b9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = tan(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.spvasm
new file mode 100644
index 0000000..c8b7bf4
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Tan %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.wgsl
new file mode 100644
index 0000000..dfc7ab8
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = tan(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm
new file mode 100644
index 0000000..8f407b5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Tanh %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.hlsl
new file mode 100644
index 0000000..fe10015
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = tanh(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.msl
new file mode 100644
index 0000000..7e67e78
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = tanh(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.spvasm
new file mode 100644
index 0000000..0454501
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Tanh %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.wgsl
new file mode 100644
index 0000000..e52aaae
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = tanh(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm
new file mode 100644
index 0000000..98318c6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Trunc %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.hlsl
new file mode 100644
index 0000000..8e6cd9e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = trunc(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.msl
new file mode 100644
index 0000000..a5f8eea
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = trunc(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.spvasm
new file mode 100644
index 0000000..675d331
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Trunc %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.wgsl
new file mode 100644
index 0000000..bcde1e7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = trunc(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm
new file mode 100644
index 0000000..4b516c1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Ceil %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..cf532f1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = ceil(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.msl
new file mode 100644
index 0000000..df24b99
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = ceil(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..bcd6bcf
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Ceil %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..9e07fad
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = ceil(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm
new file mode 100644
index 0000000..5d6feb2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Cos %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..9c500ae
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = cos(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.msl
new file mode 100644
index 0000000..3539768
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = cos(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..1a19598
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Cos %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..7bbcb58
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = cos(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm
new file mode 100644
index 0000000..719c3b3
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Cosh %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..5103700
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = cosh(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.msl
new file mode 100644
index 0000000..f7b8b3b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = cosh(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..183406e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Cosh %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..6028d58
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = cosh(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm
new file mode 100644
index 0000000..636ef29
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Exp %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..0882adc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = exp(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.msl
new file mode 100644
index 0000000..dad62b2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = exp(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..85e23b7d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Exp %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..c333e7c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = exp(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm
new file mode 100644
index 0000000..00e15cc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Exp2 %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.hlsl
new file mode 100644
index 0000000..bad88d7
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = exp2(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.msl
new file mode 100644
index 0000000..3c14f10
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = exp2(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.spvasm
new file mode 100644
index 0000000..8c65099
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Exp2 %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.wgsl
new file mode 100644
index 0000000..6cb9632
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = exp2(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm
new file mode 100644
index 0000000..4a14499
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 FAbs %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.hlsl
new file mode 100644
index 0000000..65778c2
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = abs(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.msl
new file mode 100644
index 0000000..1d7c757
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = fabs(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.spvasm
new file mode 100644
index 0000000..559526e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 FAbs %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.wgsl
new file mode 100644
index 0000000..dcc4ffa
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = abs(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm
new file mode 100644
index 0000000..af52652
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 FSign %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.hlsl
new file mode 100644
index 0000000..d408af1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = sign(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.msl
new file mode 100644
index 0000000..04cdee9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = sign(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.spvasm
new file mode 100644
index 0000000..88a34b5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 FSign %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.wgsl
new file mode 100644
index 0000000..59f383e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = sign(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm
new file mode 100644
index 0000000..8e2ee4b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %int %2 SClamp %i1 %i2 %i3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..dfa6a4c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const int x_1 = clamp(i1, i2, i3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.msl
new file mode 100644
index 0000000..f6270ef
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ int const x_1 = clamp(i1, i2, i3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..b5a717e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %int %35 SClamp %int_30 %int_35 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..1d63491
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : i32 = clamp(i1, i2, i3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm
new file mode 100644
index 0000000..0d611b5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2int %2 SClamp %v2i1 %v2i2 %v2i3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..d3f5444
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const int2 x_1 = clamp(v2i1, v2i2, v2i3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.msl
new file mode 100644
index 0000000..20d1b4f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ int2 const x_1 = clamp(v2i1, v2i2, v2i3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..abc2be9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2int %35 SClamp %22 %23 %24
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..edc1279
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<i32> = clamp(v2i1, v2i2, v2i3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm
new file mode 100644
index 0000000..010c52d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %int %2 SMax %i1 %i2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..a4dfe37
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const int x_1 = max(i1, i2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.msl
new file mode 100644
index 0000000..e8f9a6f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ int const x_1 = max(i1, i2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..01ffe59
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %int %35 SMax %int_30 %int_35
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..754e187
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : i32 = max(i1, i2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm
new file mode 100644
index 0000000..87c25bc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %int %2 SMin %i1 %i2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..ef189df
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const int x_1 = min(i1, i2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.msl
new file mode 100644
index 0000000..e95f3e1
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ int const x_1 = min(i1, i2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..a5a4c67
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %int %35 SMin %int_30 %int_35
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..828a699
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : i32 = min(i1, i2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm
new file mode 100644
index 0000000..65dd5a5
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2int %2 SMax %v2i1 %v2i2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..3c0d4d6
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const int2 x_1 = max(v2i1, v2i2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.msl
new file mode 100644
index 0000000..d8a6fa3
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ int2 const x_1 = max(v2i1, v2i2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..d2c2caa
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2int %35 SMax %22 %23
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..e947913
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<i32> = max(v2i1, v2i2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm
new file mode 100644
index 0000000..2fb9e72
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2int %2 SMin %v2i1 %v2i2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..17494ca
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const int2 x_1 = min(v2i1, v2i2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.msl
new file mode 100644
index 0000000..1e40c2c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ int2 const x_1 = min(v2i1, v2i2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..0d9ddef
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2int %35 SMin %22 %23
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..c3f15fd
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<i32> = min(v2i1, v2i2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm
new file mode 100644
index 0000000..abf3eaa
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %int %2 SAbs %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..eaa6b3c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const int x_1 = abs(i1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.msl
new file mode 100644
index 0000000..53978b8
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ int const x_1 = abs(i1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..76be129
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %int %35 SAbs %int_30
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..b60592f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : i32 = abs(i1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm
new file mode 100644
index 0000000..4aa3771
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2int %2 SAbs %v2i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..a042e61
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const int2 x_1 = abs(v2i1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.msl
new file mode 100644
index 0000000..a16acf9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ int2 const x_1 = abs(v2i1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..6a2a901
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2int %35 SAbs %22
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..74dcc1c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<i32> = abs(v2i1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm
new file mode 100644
index 0000000..0515ba0
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %uint %2 UClamp %u1 %u2 %u3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..e6d5394
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint x_1 = clamp(u1, u2, u3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.msl
new file mode 100644
index 0000000..63921c0
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint const x_1 = clamp(u1, u2, u3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..a4c872c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %uint %35 UClamp %uint_10 %uint_15 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..7d57d99
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : u32 = clamp(u1, u2, u3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm
new file mode 100644
index 0000000..d60e661
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2uint %2 UClamp %v2u1 %v2u2 %v2u3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..14b4acd
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint2 x_1 = clamp(v2u1, v2u2, v2u3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.msl
new file mode 100644
index 0000000..357c4ad
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint2 const x_1 = clamp(v2u1, v2u2, v2u3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..bb8214b
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2uint %35 UClamp %18 %19 %20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..eec1568
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<u32> = clamp(v2u1, v2u2, v2u3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm
new file mode 100644
index 0000000..c92f1a4
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %uint %2 UMax %u1 %u2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..0966e6c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint x_1 = max(u1, u2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.msl
new file mode 100644
index 0000000..7338b41
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint const x_1 = max(u1, u2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..f8d0210
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %uint %35 UMax %uint_10 %uint_15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..b3bd92f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : u32 = max(u1, u2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm
new file mode 100644
index 0000000..29c2259
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %uint %2 UMin %u1 %u2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..b1696c0
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint x_1 = min(u1, u2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.msl
new file mode 100644
index 0000000..1d6243d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint const x_1 = min(u1, u2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..2e552fe
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %uint %35 UMin %uint_10 %uint_15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..f95d6fc
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : u32 = min(u1, u2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm
new file mode 100644
index 0000000..b5963f0
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2uint %2 UMax %v2u1 %v2u2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..e3d86b0
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint2 x_1 = max(v2u1, v2u2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.msl
new file mode 100644
index 0000000..c5e299c
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint2 const x_1 = max(v2u1, v2u2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..e6805139
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2uint %35 UMax %18 %19
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..b0b6f9e
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<u32> = max(v2u1, v2u2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm
new file mode 100644
index 0000000..785230d
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm
@@ -0,0 +1,92 @@
+; Test: Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2uint %2 UMin %v2u1 %v2u2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..8c8fed9
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint2 x_1 = min(v2u1, v2u2);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.msl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.msl
new file mode 100644
index 0000000..fad0f0f
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint2 const x_1 = min(v2u1, v2u2);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..5d86c55
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2uint %35 UMin %18 %19
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..f4c5a08
--- /dev/null
+++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<u32> = min(v2u1, v2u2);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm
new file mode 100644
index 0000000..11ba12a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryArithTestBasic_Dot.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%23 = OpConstantComposite %v2uint %uint_10 %uint_20
+%24 = OpConstantComposite %v2uint %uint_20 %uint_10
+%25 = OpConstantComposite %v2int %int_30 %int_40
+%26 = OpConstantComposite %v2int %int_40 %int_30
+%27 = OpConstantComposite %v2float %float_50 %float_60
+%28 = OpConstantComposite %v2float %float_60 %float_50
+%29 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%30 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%34 = OpConstantComposite %mat2v2float %27 %28
+%35 = OpConstantComposite %mat2v2float %28 %27
+%36 = OpConstantComposite %mat3v2float %27 %28 %27
+%37 = OpConstantComposite %mat2v3float %29 %30
+%100 = OpFunction %void None %5
+%38 = OpLabel
+%1 = OpCopyObject %v2float %27
+%2 = OpCopyObject %v2float %28
+%3 = OpDot %float %1 %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.hlsl
new file mode 100644
index 0000000..94f5f56
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ const float2 x_1 = float2(50.0f, 60.0f);
+ const float2 x_2 = float2(60.0f, 50.0f);
+ const float x_3 = dot(x_1, x_2);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.msl
new file mode 100644
index 0000000..0375390
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = float2(50.0f, 60.0f);
+ float2 const x_2 = float2(60.0f, 50.0f);
+ float const x_3 = dot(x_1, x_2);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.spvasm
new file mode 100644
index 0000000..2258453
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpDot %float %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.wgsl
new file mode 100644
index 0000000..bd1ae89
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+fn main_1() {
+ let x_1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let x_3 : f32 = dot(x_1, x_2);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm
new file mode 100644
index 0000000..a1a91be
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvBinaryArithTestBasic_FMod_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFMod %float %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..6a5fd68
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_1 = (50.0f - (60.0f * floor((50.0f / 60.0f))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..71427b2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = (50.0f - (60.0f * floor((50.0f / 60.0f))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..6eec256
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ %9 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpFDiv %float %float_50 %float_60
+ %8 = OpExtInst %float %9 Floor %10
+ %11 = OpFMul %float %float_60 %8
+ %12 = OpFSub %float %float_50 %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..19dadbf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : f32 = (50.0 - (60.0 * floor((50.0 / 60.0))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm
new file mode 100644
index 0000000..43fa080
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvBinaryArithTestBasic_FMod_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFMod %v2float %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..fc465ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float2 x_1 = (float2(50.0f, 60.0f) - (float2(60.0f, 50.0f) * floor((float2(50.0f, 60.0f) / float2(60.0f, 50.0f)))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..b00d178
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = (float2(50.0f, 60.0f) - (float2(60.0f, 50.0f) * floor((float2(50.0f, 60.0f) / float2(60.0f, 50.0f)))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..d4c9808
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ %12 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpFDiv %v2float %9 %10
+ %11 = OpExtInst %v2float %12 Floor %13
+ %14 = OpFMul %v2float %10 %11
+ %15 = OpFSub %v2float %9 %14
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..25e93f04
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<f32> = (vec2<f32>(50.0, 60.0) - (vec2<f32>(60.0, 50.0) * floor((vec2<f32>(50.0, 60.0) / vec2<f32>(60.0, 50.0)))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm
new file mode 100644
index 0000000..ea116bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%23 = OpConstantComposite %v2uint %uint_10 %uint_20
+%24 = OpConstantComposite %v2uint %uint_20 %uint_10
+%25 = OpConstantComposite %v2int %int_30 %int_40
+%26 = OpConstantComposite %v2int %int_40 %int_30
+%27 = OpConstantComposite %v2float %float_50 %float_60
+%28 = OpConstantComposite %v2float %float_60 %float_50
+%29 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%30 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%34 = OpConstantComposite %mat2v2float %27 %28
+%35 = OpConstantComposite %mat2v2float %28 %27
+%36 = OpConstantComposite %mat3v2float %27 %28 %27
+%37 = OpConstantComposite %mat2v3float %29 %30
+%100 = OpFunction %void None %4
+%38 = OpLabel
+%1 = OpCopyObject %mat2v2float %34
+%2 = OpCopyObject %mat2v2float %35
+%10 = OpMatrixTimesMatrix %mat2v2float %1 %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.hlsl
new file mode 100644
index 0000000..679689f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ const float2x2 x_1 = float2x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f));
+ const float2x2 x_2 = float2x2(float2(60.0f, 50.0f), float2(50.0f, 60.0f));
+ const float2x2 x_10 = mul(x_2, x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.msl
new file mode 100644
index 0000000..c454b67
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2x2 const x_1 = float2x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f));
+ float2x2 const x_2 = float2x2(float2(60.0f, 50.0f), float2(50.0f, 60.0f));
+ float2x2 const x_10 = (x_1 * x_2);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.spvasm
new file mode 100644
index 0000000..900987a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat2v2float = OpTypeMatrix %v2float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %12 = OpConstantComposite %mat2v2float %10 %11
+ %13 = OpConstantComposite %mat2v2float %11 %10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %14 = OpMatrixTimesMatrix %mat2v2float %12 %13
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.wgsl
new file mode 100644
index 0000000..d05a954
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+fn main_1() {
+ let x_1 : mat2x2<f32> = mat2x2<f32>(vec2<f32>(50.0, 60.0), vec2<f32>(60.0, 50.0));
+ let x_2 : mat2x2<f32> = mat2x2<f32>(vec2<f32>(60.0, 50.0), vec2<f32>(50.0, 60.0));
+ let x_10 : mat2x2<f32> = (x_1 * x_2);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm
new file mode 100644
index 0000000..d20ed13
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%23 = OpConstantComposite %v2uint %uint_10 %uint_20
+%24 = OpConstantComposite %v2uint %uint_20 %uint_10
+%25 = OpConstantComposite %v2int %int_30 %int_40
+%26 = OpConstantComposite %v2int %int_40 %int_30
+%27 = OpConstantComposite %v2float %float_50 %float_60
+%28 = OpConstantComposite %v2float %float_60 %float_50
+%29 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%30 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%34 = OpConstantComposite %mat2v2float %27 %28
+%35 = OpConstantComposite %mat2v2float %28 %27
+%36 = OpConstantComposite %mat3v2float %27 %28 %27
+%37 = OpConstantComposite %mat2v3float %29 %30
+%100 = OpFunction %void None %4
+%38 = OpLabel
+%1 = OpCopyObject %mat2v2float %34
+%2 = OpCopyObject %float %float_50
+%10 = OpMatrixTimesScalar %mat2v2float %1 %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..b51b74e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2x2 x_1 = float2x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f));
+ const float2x2 x_10 = (x_1 * 50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.msl
new file mode 100644
index 0000000..5e2d89d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2x2 const x_1 = float2x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f));
+ float const x_2 = 50.0f;
+ float2x2 const x_10 = (x_1 * x_2);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..b0279b1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat2v2float = OpTypeMatrix %v2float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %12 = OpConstantComposite %mat2v2float %10 %11
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpMatrixTimesScalar %mat2v2float %12 %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..f4611f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+fn main_1() {
+ let x_1 : mat2x2<f32> = mat2x2<f32>(vec2<f32>(50.0, 60.0), vec2<f32>(60.0, 50.0));
+ let x_2 : f32 = 50.0;
+ let x_10 : mat2x2<f32> = (x_1 * x_2);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm
new file mode 100644
index 0000000..ef0e49f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryArithTestBasic_MatrixTimesVector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%23 = OpConstantComposite %v2uint %uint_10 %uint_20
+%24 = OpConstantComposite %v2uint %uint_20 %uint_10
+%25 = OpConstantComposite %v2int %int_30 %int_40
+%26 = OpConstantComposite %v2int %int_40 %int_30
+%27 = OpConstantComposite %v2float %float_50 %float_60
+%28 = OpConstantComposite %v2float %float_60 %float_50
+%29 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%30 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%34 = OpConstantComposite %mat2v2float %27 %28
+%35 = OpConstantComposite %mat2v2float %28 %27
+%36 = OpConstantComposite %mat3v2float %27 %28 %27
+%37 = OpConstantComposite %mat2v3float %29 %30
+%100 = OpFunction %void None %4
+%38 = OpLabel
+%1 = OpCopyObject %mat2v2float %34
+%2 = OpCopyObject %v2float %27
+%10 = OpMatrixTimesVector %v2float %1 %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.hlsl
new file mode 100644
index 0000000..7f8ada7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ const float2x2 x_1 = float2x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f));
+ const float2 x_2 = float2(50.0f, 60.0f);
+ const float2 x_10 = mul(x_2, x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.msl
new file mode 100644
index 0000000..5c2941d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2x2 const x_1 = float2x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f));
+ float2 const x_2 = float2(50.0f, 60.0f);
+ float2 const x_10 = (x_1 * x_2);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.spvasm
new file mode 100644
index 0000000..a06a834
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat2v2float = OpTypeMatrix %v2float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %12 = OpConstantComposite %mat2v2float %10 %11
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpMatrixTimesVector %v2float %12 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.wgsl
new file mode 100644
index 0000000..d66e9e4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+fn main_1() {
+ let x_1 : mat2x2<f32> = mat2x2<f32>(vec2<f32>(50.0, 60.0), vec2<f32>(60.0, 50.0));
+ let x_2 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_10 : vec2<f32> = (x_1 * x_2);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm
new file mode 100644
index 0000000..07cff26
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryArithTestBasic_OuterProduct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%23 = OpConstantComposite %v2uint %uint_10 %uint_20
+%24 = OpConstantComposite %v2uint %uint_20 %uint_10
+%25 = OpConstantComposite %v2int %int_30 %int_40
+%26 = OpConstantComposite %v2int %int_40 %int_30
+%27 = OpConstantComposite %v2float %float_50 %float_60
+%28 = OpConstantComposite %v2float %float_60 %float_50
+%29 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%30 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%34 = OpConstantComposite %mat2v2float %27 %28
+%35 = OpConstantComposite %mat2v2float %28 %27
+%36 = OpConstantComposite %mat3v2float %27 %28 %27
+%37 = OpConstantComposite %mat2v3float %29 %30
+%100 = OpFunction %void None %5
+%38 = OpLabel
+%1 = OpFAdd %v3float %29 %29
+%2 = OpFAdd %v2float %28 %27
+%3 = OpOuterProduct %mat2v3float %1 %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.hlsl
new file mode 100644
index 0000000..b6eb7ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ const float3 x_1 = (float3(50.0f, 60.0f, 70.0f) + float3(50.0f, 60.0f, 70.0f));
+ const float2 x_2 = (float2(60.0f, 50.0f) + float2(50.0f, 60.0f));
+ const float2x3 x_3 = float2x3(float3((x_2.x * x_1.x), (x_2.x * x_1.y), (x_2.x * x_1.z)), float3((x_2.y * x_1.x), (x_2.y * x_1.y), (x_2.y * x_1.z)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.msl
new file mode 100644
index 0000000..7246ce8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float3 const x_1 = (float3(50.0f, 60.0f, 70.0f) + float3(50.0f, 60.0f, 70.0f));
+ float2 const x_2 = (float2(60.0f, 50.0f) + float2(50.0f, 60.0f));
+ float2x3 const x_3 = float2x3(float3((x_2.x * x_1.x), (x_2.x * x_1.y), (x_2.x * x_1.z)), float3((x_2.y * x_1.x), (x_2.y * x_1.y), (x_2.y * x_1.z)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.spvasm
new file mode 100644
index 0000000..cc8d70b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %10 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantComposite %v2float %float_60 %float_50
+ %14 = OpConstantComposite %v2float %float_50 %float_60
+%mat2v3float = OpTypeMatrix %v3float 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFAdd %v3float %10 %10
+ %15 = OpFAdd %v2float %13 %14
+ %17 = OpCompositeExtract %float %15 0
+ %18 = OpCompositeExtract %float %11 0
+ %19 = OpFMul %float %17 %18
+ %20 = OpCompositeExtract %float %15 0
+ %21 = OpCompositeExtract %float %11 1
+ %22 = OpFMul %float %20 %21
+ %23 = OpCompositeExtract %float %15 0
+ %24 = OpCompositeExtract %float %11 2
+ %25 = OpFMul %float %23 %24
+ %26 = OpCompositeConstruct %v3float %19 %22 %25
+ %27 = OpCompositeExtract %float %15 1
+ %28 = OpCompositeExtract %float %11 0
+ %29 = OpFMul %float %27 %28
+ %30 = OpCompositeExtract %float %15 1
+ %31 = OpCompositeExtract %float %11 1
+ %32 = OpFMul %float %30 %31
+ %33 = OpCompositeExtract %float %15 1
+ %34 = OpCompositeExtract %float %11 2
+ %35 = OpFMul %float %33 %34
+ %36 = OpCompositeConstruct %v3float %29 %32 %35
+ %37 = OpCompositeConstruct %mat2v3float %26 %36
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.wgsl
new file mode 100644
index 0000000..37432da
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+fn main_1() {
+ let x_1 : vec3<f32> = (vec3<f32>(50.0, 60.0, 70.0) + vec3<f32>(50.0, 60.0, 70.0));
+ let x_2 : vec2<f32> = (vec2<f32>(60.0, 50.0) + vec2<f32>(50.0, 60.0));
+ let x_3 : mat2x3<f32> = mat2x3<f32>(vec3<f32>((x_2.x * x_1.x), (x_2.x * x_1.y), (x_2.x * x_1.z)), vec3<f32>((x_2.y * x_1.x), (x_2.y * x_1.y), (x_2.y * x_1.z)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm
new file mode 100644
index 0000000..d47f678
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSDiv %uint %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.hlsl
new file mode 100644
index 0000000..d3c8c9f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint((30 / 40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.msl
new file mode 100644
index 0000000..4214737
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>((30 / 40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.spvasm
new file mode 100644
index 0000000..c6dee99
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpSDiv %int %int_30 %int_40
+ %5 = OpBitcast %uint %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.wgsl
new file mode 100644
index 0000000..046334f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>((30 / 40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm
new file mode 100644
index 0000000..26a841b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSDiv %v2uint %23 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.hlsl
new file mode 100644
index 0000000..c142541
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint((int2(30, 40) / int2(40, 30)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.msl
new file mode 100644
index 0000000..b313264
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>((int2(30, 40) / int2(40, 30)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.spvasm
new file mode 100644
index 0000000..a03b2fe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %13 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %14 = OpSDiv %v2int %12 %13
+ %5 = OpBitcast %v2uint %14
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.wgsl
new file mode 100644
index 0000000..bee7f57
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30, 40) / vec2<i32>(40, 30)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm
new file mode 100644
index 0000000..c1ba578
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSMod %uint %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.hlsl
new file mode 100644
index 0000000..78291bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint((30 % 40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.msl
new file mode 100644
index 0000000..ba27adf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>((30 % 40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.spvasm
new file mode 100644
index 0000000..84d2f53
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpSMod %int %int_30 %int_40
+ %5 = OpBitcast %uint %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.wgsl
new file mode 100644
index 0000000..0bbe6ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>((30 % 40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm
new file mode 100644
index 0000000..528287c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSMod %v2uint %23 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.hlsl
new file mode 100644
index 0000000..174eca0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint((int2(30, 40) % int2(40, 30)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.msl
new file mode 100644
index 0000000..88a2915
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>((int2(30, 40) % int2(40, 30)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.spvasm
new file mode 100644
index 0000000..f22b845
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %13 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %14 = OpSMod %v2int %12 %13
+ %5 = OpBitcast %v2uint %14
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.wgsl
new file mode 100644
index 0000000..23f1bd0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30, 40) % vec2<i32>(40, 30)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm
new file mode 100644
index 0000000..45ce944
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%23 = OpConstantComposite %v2uint %uint_10 %uint_20
+%24 = OpConstantComposite %v2uint %uint_20 %uint_10
+%25 = OpConstantComposite %v2int %int_30 %int_40
+%26 = OpConstantComposite %v2int %int_40 %int_30
+%27 = OpConstantComposite %v2float %float_50 %float_60
+%28 = OpConstantComposite %v2float %float_60 %float_50
+%29 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%30 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%34 = OpConstantComposite %mat2v2float %27 %28
+%35 = OpConstantComposite %mat2v2float %28 %27
+%36 = OpConstantComposite %mat3v2float %27 %28 %27
+%37 = OpConstantComposite %mat2v3float %29 %30
+%100 = OpFunction %void None %4
+%38 = OpLabel
+%1 = OpCopyObject %mat2v2float %34
+%2 = OpCopyObject %v2float %27
+%10 = OpMatrixTimesVector %v2float %1 %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.hlsl
new file mode 100644
index 0000000..7f8ada7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ const float2x2 x_1 = float2x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f));
+ const float2 x_2 = float2(50.0f, 60.0f);
+ const float2 x_10 = mul(x_2, x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.msl
new file mode 100644
index 0000000..5c2941d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2x2 const x_1 = float2x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f));
+ float2 const x_2 = float2(50.0f, 60.0f);
+ float2 const x_10 = (x_1 * x_2);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.spvasm
new file mode 100644
index 0000000..a06a834
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat2v2float = OpTypeMatrix %v2float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %12 = OpConstantComposite %mat2v2float %10 %11
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpMatrixTimesVector %v2float %12 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.wgsl
new file mode 100644
index 0000000..d66e9e4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+fn main_1() {
+ let x_1 : mat2x2<f32> = mat2x2<f32>(vec2<f32>(50.0, 60.0), vec2<f32>(60.0, 50.0));
+ let x_2 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_10 : vec2<f32> = (x_1 * x_2);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm
new file mode 100644
index 0000000..5d76916
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryArithTestBasic_VectorTimesScalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%23 = OpConstantComposite %v2uint %uint_10 %uint_20
+%24 = OpConstantComposite %v2uint %uint_20 %uint_10
+%25 = OpConstantComposite %v2int %int_30 %int_40
+%26 = OpConstantComposite %v2int %int_40 %int_30
+%27 = OpConstantComposite %v2float %float_50 %float_60
+%28 = OpConstantComposite %v2float %float_60 %float_50
+%29 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%30 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%34 = OpConstantComposite %mat2v2float %27 %28
+%35 = OpConstantComposite %mat2v2float %28 %27
+%36 = OpConstantComposite %mat3v2float %27 %28 %27
+%37 = OpConstantComposite %mat2v3float %29 %30
+%100 = OpFunction %void None %4
+%38 = OpLabel
+%1 = OpCopyObject %v2float %27
+%2 = OpCopyObject %float %float_50
+%10 = OpVectorTimesScalar %v2float %1 %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..1843297
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_1 = float2(50.0f, 60.0f);
+ const float2 x_10 = (x_1 * 50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.msl
new file mode 100644
index 0000000..c420ea4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = float2(50.0f, 60.0f);
+ float const x_2 = 50.0f;
+ float2 const x_10 = (x_1 * x_2);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..64946ed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpVectorTimesScalar %v2float %9 %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..ac34d3c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+fn main_1() {
+ let x_1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_2 : f32 = 50.0;
+ let x_10 : vec2<f32> = (x_1 * x_2);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm
new file mode 100644
index 0000000..cf7cd34
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %float %float_50
+%2 = OpDPdx %float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..1d554c3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_2 = ddx(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.msl
new file mode 100644
index 0000000..2072656
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = 50.0f;
+ float const x_2 = dfdx(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..9bcc44f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.spvasm
@@ -0,0 +1,25 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpDPdx %float %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..82db1f9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : f32 = 50.0;
+ let x_2 : f32 = dpdx(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm
new file mode 100644
index 0000000..ff51042
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v2float %26
+%2 = OpDPdx %v2float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..1e5872e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_1 = float2(50.0f, 60.0f);
+ const float2 x_2 = ddx(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.msl
new file mode 100644
index 0000000..0a0efd2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = float2(50.0f, 60.0f);
+ float2 const x_2 = dfdx(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..ed86b26
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpDPdx %v2float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..36704aa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_2 : vec2<f32> = dpdx(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm
new file mode 100644
index 0000000..67692fb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v2float %26
+%2 = OpDPdxFine %v2float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.hlsl
new file mode 100644
index 0000000..9404848
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_1 = float2(50.0f, 60.0f);
+ const float2 x_2 = ddx_fine(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.msl
new file mode 100644
index 0000000..0a0efd2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = float2(50.0f, 60.0f);
+ float2 const x_2 = dfdx(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.spvasm
new file mode 100644
index 0000000..ed18e8b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpDPdxFine %v2float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.wgsl
new file mode 100644
index 0000000..d7dacf3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_2 : vec2<f32> = dpdxFine(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm
new file mode 100644
index 0000000..2950eb3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v3float %28
+%2 = OpDPdxFine %v3float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.hlsl
new file mode 100644
index 0000000..2f2f39a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float3 x_1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 x_2 = ddx_fine(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.msl
new file mode 100644
index 0000000..d0b0b54
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float3 const x_1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const x_2 = dfdx(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.spvasm
new file mode 100644
index 0000000..8d9e49c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %10 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpDPdxFine %v3float %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.wgsl
new file mode 100644
index 0000000..ea448bc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let x_2 : vec3<f32> = dpdxFine(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm
new file mode 100644
index 0000000..29aae14
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %float %float_50
+%2 = OpDPdyFine %float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.hlsl
new file mode 100644
index 0000000..a82b871
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_2 = ddy_fine(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.msl
new file mode 100644
index 0000000..3eb6aaf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = 50.0f;
+ float const x_2 = dfdy(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.spvasm
new file mode 100644
index 0000000..0f6f954
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpDPdyFine %float %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.wgsl
new file mode 100644
index 0000000..fe17388
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : f32 = 50.0;
+ let x_2 : f32 = dpdyFine(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm
new file mode 100644
index 0000000..2675113
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v2float %26
+%2 = OpDPdyFine %v2float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.hlsl
new file mode 100644
index 0000000..978f994
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_1 = float2(50.0f, 60.0f);
+ const float2 x_2 = ddy_fine(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.msl
new file mode 100644
index 0000000..125c08e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = float2(50.0f, 60.0f);
+ float2 const x_2 = dfdy(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.spvasm
new file mode 100644
index 0000000..dcf9a40
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpDPdyFine %v2float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.wgsl
new file mode 100644
index 0000000..1d303f3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_2 : vec2<f32> = dpdyFine(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm
new file mode 100644
index 0000000..0cd36e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v3float %28
+%2 = OpDPdyFine %v3float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.hlsl
new file mode 100644
index 0000000..14fdbca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float3 x_1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 x_2 = ddy_fine(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.msl
new file mode 100644
index 0000000..999f205
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float3 const x_1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const x_2 = dfdy(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.spvasm
new file mode 100644
index 0000000..7f14b55
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %10 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpDPdyFine %v3float %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.wgsl
new file mode 100644
index 0000000..0afb23d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let x_2 : vec3<f32> = dpdyFine(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm
new file mode 100644
index 0000000..b919f68
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %float %float_50
+%2 = OpFwidthFine %float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.hlsl
new file mode 100644
index 0000000..f015927
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_2 = fwidth(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.msl
new file mode 100644
index 0000000..948f0c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = 50.0f;
+ float const x_2 = fwidth(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.spvasm
new file mode 100644
index 0000000..698703c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpFwidthFine %float %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.wgsl
new file mode 100644
index 0000000..bbea772
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : f32 = 50.0;
+ let x_2 : f32 = fwidthFine(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm
new file mode 100644
index 0000000..e2934ee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v2float %26
+%2 = OpFwidthFine %v2float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.hlsl
new file mode 100644
index 0000000..a945113
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_1 = float2(50.0f, 60.0f);
+ const float2 x_2 = fwidth(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.msl
new file mode 100644
index 0000000..ee87b31
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = float2(50.0f, 60.0f);
+ float2 const x_2 = fwidth(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.spvasm
new file mode 100644
index 0000000..713c113
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpFwidthFine %v2float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.wgsl
new file mode 100644
index 0000000..f67a29a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_2 : vec2<f32> = fwidthFine(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm
new file mode 100644
index 0000000..dcc45e4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v3float %28
+%2 = OpFwidthFine %v3float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.hlsl
new file mode 100644
index 0000000..ff6dce6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float3 x_1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 x_2 = fwidth(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.msl
new file mode 100644
index 0000000..8209a1d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float3 const x_1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const x_2 = fwidth(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.spvasm
new file mode 100644
index 0000000..8252c42
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %10 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFwidthFine %v3float %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.wgsl
new file mode 100644
index 0000000..68b3fbf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let x_2 : vec3<f32> = fwidthFine(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm
new file mode 100644
index 0000000..8b525db
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %float %float_50
+%2 = OpDPdxCoarse %float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.hlsl
new file mode 100644
index 0000000..24551be
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_2 = ddx_coarse(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.msl
new file mode 100644
index 0000000..2072656
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = 50.0f;
+ float const x_2 = dfdx(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.spvasm
new file mode 100644
index 0000000..31a916f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpDPdxCoarse %float %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.wgsl
new file mode 100644
index 0000000..0d94747
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : f32 = 50.0;
+ let x_2 : f32 = dpdxCoarse(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm
new file mode 100644
index 0000000..6b6430c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v2float %26
+%2 = OpDPdxCoarse %v2float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.hlsl
new file mode 100644
index 0000000..00bec1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_1 = float2(50.0f, 60.0f);
+ const float2 x_2 = ddx_coarse(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.msl
new file mode 100644
index 0000000..0a0efd2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = float2(50.0f, 60.0f);
+ float2 const x_2 = dfdx(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.spvasm
new file mode 100644
index 0000000..ab012a7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpDPdxCoarse %v2float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.wgsl
new file mode 100644
index 0000000..acc24bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_2 : vec2<f32> = dpdxCoarse(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm
new file mode 100644
index 0000000..7a15e91
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v3float %28
+%2 = OpDPdx %v3float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..f9d2045
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float3 x_1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 x_2 = ddx(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.msl
new file mode 100644
index 0000000..d0b0b54
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float3 const x_1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const x_2 = dfdx(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..b1749a2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %10 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpDPdx %v3float %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..398fb2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let x_2 : vec3<f32> = dpdx(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm
new file mode 100644
index 0000000..81b894e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v3float %28
+%2 = OpDPdxCoarse %v3float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.hlsl
new file mode 100644
index 0000000..9588372
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float3 x_1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 x_2 = ddx_coarse(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.msl
new file mode 100644
index 0000000..d0b0b54
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float3 const x_1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const x_2 = dfdx(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.spvasm
new file mode 100644
index 0000000..3593979
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %10 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpDPdxCoarse %v3float %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.wgsl
new file mode 100644
index 0000000..9b568c0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let x_2 : vec3<f32> = dpdxCoarse(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm
new file mode 100644
index 0000000..eeb9324
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %float %float_50
+%2 = OpDPdyCoarse %float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.hlsl
new file mode 100644
index 0000000..f79885f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_2 = ddy_coarse(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.msl
new file mode 100644
index 0000000..3eb6aaf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = 50.0f;
+ float const x_2 = dfdy(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.spvasm
new file mode 100644
index 0000000..55befd0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpDPdyCoarse %float %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.wgsl
new file mode 100644
index 0000000..fbdafc5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : f32 = 50.0;
+ let x_2 : f32 = dpdyCoarse(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm
new file mode 100644
index 0000000..38ecedf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v2float %26
+%2 = OpDPdyCoarse %v2float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.hlsl
new file mode 100644
index 0000000..b375285
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_1 = float2(50.0f, 60.0f);
+ const float2 x_2 = ddy_coarse(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.msl
new file mode 100644
index 0000000..125c08e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = float2(50.0f, 60.0f);
+ float2 const x_2 = dfdy(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.spvasm
new file mode 100644
index 0000000..93e2966
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpDPdyCoarse %v2float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.wgsl
new file mode 100644
index 0000000..91825b5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_2 : vec2<f32> = dpdyCoarse(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm
new file mode 100644
index 0000000..19bf242
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v3float %28
+%2 = OpDPdyCoarse %v3float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.hlsl
new file mode 100644
index 0000000..99d51c1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float3 x_1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 x_2 = ddy_coarse(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.msl
new file mode 100644
index 0000000..999f205
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float3 const x_1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const x_2 = dfdy(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.spvasm
new file mode 100644
index 0000000..35bc166
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %10 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpDPdyCoarse %v3float %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.wgsl
new file mode 100644
index 0000000..0d04201
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let x_2 : vec3<f32> = dpdyCoarse(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm
new file mode 100644
index 0000000..920f6cd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %float %float_50
+%2 = OpFwidthCoarse %float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.hlsl
new file mode 100644
index 0000000..f015927
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_2 = fwidth(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.msl
new file mode 100644
index 0000000..948f0c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = 50.0f;
+ float const x_2 = fwidth(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.spvasm
new file mode 100644
index 0000000..e0e3703
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpFwidthCoarse %float %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.wgsl
new file mode 100644
index 0000000..d2dba47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : f32 = 50.0;
+ let x_2 : f32 = fwidthCoarse(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm
new file mode 100644
index 0000000..846a47f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v2float %26
+%2 = OpFwidthCoarse %v2float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.hlsl
new file mode 100644
index 0000000..a945113
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_1 = float2(50.0f, 60.0f);
+ const float2 x_2 = fwidth(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.msl
new file mode 100644
index 0000000..ee87b31
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = float2(50.0f, 60.0f);
+ float2 const x_2 = fwidth(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.spvasm
new file mode 100644
index 0000000..ad91ad8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpFwidthCoarse %v2float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.wgsl
new file mode 100644
index 0000000..5ddce50
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_2 : vec2<f32> = fwidthCoarse(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm
new file mode 100644
index 0000000..d14afc2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v3float %28
+%2 = OpFwidthCoarse %v3float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.hlsl
new file mode 100644
index 0000000..ff6dce6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float3 x_1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 x_2 = fwidth(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.msl
new file mode 100644
index 0000000..8209a1d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float3 const x_1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const x_2 = fwidth(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.spvasm
new file mode 100644
index 0000000..973575b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %10 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFwidthCoarse %v3float %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.wgsl
new file mode 100644
index 0000000..d628e0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let x_2 : vec3<f32> = fwidthCoarse(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm
new file mode 100644
index 0000000..72492d0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %float %float_50
+%2 = OpDPdy %float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..ba90055
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_2 = ddy(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.msl
new file mode 100644
index 0000000..3eb6aaf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = 50.0f;
+ float const x_2 = dfdy(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..18dc2ef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.spvasm
@@ -0,0 +1,25 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpDPdy %float %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..d83de4f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : f32 = 50.0;
+ let x_2 : f32 = dpdy(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm
new file mode 100644
index 0000000..471cfec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v2float %26
+%2 = OpDPdy %v2float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..63fe558
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_1 = float2(50.0f, 60.0f);
+ const float2 x_2 = ddy(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.msl
new file mode 100644
index 0000000..125c08e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = float2(50.0f, 60.0f);
+ float2 const x_2 = dfdy(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..3c40cc6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpDPdy %v2float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..7e84a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_2 : vec2<f32> = dpdy(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm
new file mode 100644
index 0000000..bdbd489
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v3float %28
+%2 = OpDPdy %v3float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..2597a98
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float3 x_1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 x_2 = ddy(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.msl
new file mode 100644
index 0000000..999f205
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float3 const x_1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const x_2 = dfdy(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..e9e4d08
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %10 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpDPdy %v3float %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..52878ed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let x_2 : vec3<f32> = dpdy(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm
new file mode 100644
index 0000000..da62431
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %float %float_50
+%2 = OpFwidth %float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.hlsl
new file mode 100644
index 0000000..f015927
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_2 = fwidth(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.msl
new file mode 100644
index 0000000..948f0c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = 50.0f;
+ float const x_2 = fwidth(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.spvasm
new file mode 100644
index 0000000..c71a50a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.spvasm
@@ -0,0 +1,25 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpFwidth %float %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.wgsl
new file mode 100644
index 0000000..f3acf8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : f32 = 50.0;
+ let x_2 : f32 = fwidth(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm
new file mode 100644
index 0000000..69a4fec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v2float %26
+%2 = OpFwidth %v2float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.hlsl
new file mode 100644
index 0000000..a945113
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_1 = float2(50.0f, 60.0f);
+ const float2 x_2 = fwidth(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.msl
new file mode 100644
index 0000000..ee87b31
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = float2(50.0f, 60.0f);
+ float2 const x_2 = fwidth(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.spvasm
new file mode 100644
index 0000000..3f4bc91
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpFwidth %v2float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.wgsl
new file mode 100644
index 0000000..a16d4d5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_2 : vec2<f32> = fwidth(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm
new file mode 100644
index 0000000..485f363
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %v3float %28
+%2 = OpFwidth %v3float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.hlsl
new file mode 100644
index 0000000..ff6dce6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float3 x_1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 x_2 = fwidth(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.msl
new file mode 100644
index 0000000..8209a1d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float3 const x_1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const x_2 = fwidth(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.spvasm
new file mode 100644
index 0000000..f12d235
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %10 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFwidth %v3float %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.wgsl
new file mode 100644
index 0000000..bd2752b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let x_2 : vec3<f32> = fwidth(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm
new file mode 100644
index 0000000..95b8e4d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability DerivativeControl
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %float %float_50
+%2 = OpDPdxFine %float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.hlsl
new file mode 100644
index 0000000..c1aadba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_2 = ddx_fine(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.msl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.msl
new file mode 100644
index 0000000..2072656
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = 50.0f;
+ float const x_2 = dfdx(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.spvasm
new file mode 100644
index 0000000..d7754fe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpDPdxFine %float %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.wgsl
new file mode 100644
index 0000000..c61e2ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : f32 = 50.0;
+ let x_2 : f32 = dpdxFine(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm
new file mode 100644
index 0000000..c86c7be
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvFUnordTest_FUnordEqual_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFUnordEqual %bool %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..d4ed465
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = !((50.0f != 60.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..d7cb0c0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = !((50.0f != 60.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..2728036
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpFOrdNotEqual %bool %float_50 %float_60
+ %5 = OpLogicalNot %bool %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..7e6f985
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = !((50.0 != 60.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm
new file mode 100644
index 0000000..165eea1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvFUnordTest_FUnordEqual_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFUnordEqual %v2bool %29 %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..6e2c9c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = !((float2(50.0f, 60.0f) != float2(60.0f, 50.0f)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..55eb273
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = !((float2(50.0f, 60.0f) != float2(60.0f, 50.0f)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..6865ccc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %12 = OpFOrdNotEqual %v2bool %10 %11
+ %5 = OpLogicalNot %v2bool %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..91630e5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = !((vec2<f32>(50.0, 60.0) != vec2<f32>(60.0, 50.0)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm
new file mode 100644
index 0000000..d400549
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFUnordGreaterThanEqual %bool %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..6b5a3c6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = !((50.0f < 60.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..9c519dc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = !((50.0f < 60.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..4c6f483
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpFOrdLessThan %bool %float_50 %float_60
+ %5 = OpLogicalNot %bool %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..c9006fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = !((50.0 < 60.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm
new file mode 100644
index 0000000..6b18024
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFUnordGreaterThanEqual %v2bool %29 %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..e911ebf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = !((float2(50.0f, 60.0f) < float2(60.0f, 50.0f)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..e9ababc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = !((float2(50.0f, 60.0f) < float2(60.0f, 50.0f)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..c9427b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %12 = OpFOrdLessThan %v2bool %10 %11
+ %5 = OpLogicalNot %v2bool %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..d92afa3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = !((vec2<f32>(50.0, 60.0) < vec2<f32>(60.0, 50.0)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm
new file mode 100644
index 0000000..ab755f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFUnordGreaterThan %bool %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..c8232c5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = !((50.0f <= 60.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..1c146e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = !((50.0f <= 60.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..5dbe6fe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpFOrdLessThanEqual %bool %float_50 %float_60
+ %5 = OpLogicalNot %bool %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..bfb44bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = !((50.0 <= 60.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm
new file mode 100644
index 0000000..d861844
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvFUnordTest_FUnordGreaterThan_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFUnordGreaterThan %v2bool %29 %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..990f329
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = !((float2(50.0f, 60.0f) <= float2(60.0f, 50.0f)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..5e7ab76
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = !((float2(50.0f, 60.0f) <= float2(60.0f, 50.0f)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..bd947be
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %12 = OpFOrdLessThanEqual %v2bool %10 %11
+ %5 = OpLogicalNot %v2bool %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..c20efcd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = !((vec2<f32>(50.0, 60.0) <= vec2<f32>(60.0, 50.0)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm
new file mode 100644
index 0000000..452ccf4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFUnordLessThanEqual %bool %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..448c8b3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = !((50.0f > 60.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..211c9b0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = !((50.0f > 60.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..0b46ad4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpFOrdGreaterThan %bool %float_50 %float_60
+ %5 = OpLogicalNot %bool %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..f0e117f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = !((50.0 > 60.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm
new file mode 100644
index 0000000..905e958
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFUnordLessThanEqual %v2bool %29 %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..d9a0e67
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = !((float2(50.0f, 60.0f) > float2(60.0f, 50.0f)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..449f8f6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = !((float2(50.0f, 60.0f) > float2(60.0f, 50.0f)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..9da8af0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %12 = OpFOrdGreaterThan %v2bool %10 %11
+ %5 = OpLogicalNot %v2bool %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..a78ec59
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = !((vec2<f32>(50.0, 60.0) > vec2<f32>(60.0, 50.0)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm
new file mode 100644
index 0000000..777d247
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvFUnordTest_FUnordLessThan_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFUnordLessThan %bool %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..68ba23d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = !((50.0f >= 60.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..c1f9ec6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = !((50.0f >= 60.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..ce97680
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpFOrdGreaterThanEqual %bool %float_50 %float_60
+ %5 = OpLogicalNot %bool %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..288eb16
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = !((50.0 >= 60.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm
new file mode 100644
index 0000000..3e9064e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvFUnordTest_FUnordLessThan_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFUnordLessThan %v2bool %29 %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..c75e8f1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = !((float2(50.0f, 60.0f) >= float2(60.0f, 50.0f)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..d1df2a8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = !((float2(50.0f, 60.0f) >= float2(60.0f, 50.0f)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..88b76a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %12 = OpFOrdGreaterThanEqual %v2bool %10 %11
+ %5 = OpLogicalNot %v2bool %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..54563a6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = !((vec2<f32>(50.0, 60.0) >= vec2<f32>(60.0, 50.0)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm
new file mode 100644
index 0000000..57d6df7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvFUnordTest_FUnordNotEqual_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFUnordNotEqual %bool %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..4e0d011
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = !((50.0f == 60.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..0c11121
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = !((50.0f == 60.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..1914d11
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpFOrdEqual %bool %float_50 %float_60
+ %5 = OpLogicalNot %bool %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..26e0da0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = !((50.0 == 60.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm
new file mode 100644
index 0000000..0848332
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvFUnordTest_FUnordNotEqual_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFUnordNotEqual %v2bool %29 %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..6babf24
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = !((float2(50.0f, 60.0f) == float2(60.0f, 50.0f)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..2a6bb86
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = !((float2(50.0f, 60.0f) == float2(60.0f, 50.0f)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..803c87d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %12 = OpFOrdEqual %v2bool %10 %11
+ %5 = OpLogicalNot %v2bool %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..c6e1a26
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = !((vec2<f32>(50.0, 60.0) == vec2<f32>(60.0, 50.0)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm
new file mode 100644
index 0000000..ad88622
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvLogicalTest_All.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpAll %bool %23
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.hlsl
new file mode 100644
index 0000000..7baa0d3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = all(bool2(true, false));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.msl b/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.msl
new file mode 100644
index 0000000..6471daa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = all(bool2(true, false));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.spvasm
new file mode 100644
index 0000000..4f0ec93
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %10 = OpConstantComposite %v2bool %true %false
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpAll %bool %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.wgsl
new file mode 100644
index 0000000..13754e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = all(vec2<bool>(true, false));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm
new file mode 100644
index 0000000..fb37319
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvLogicalTest_Any.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpAny %bool %23
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.hlsl
new file mode 100644
index 0000000..355566f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = any(bool2(true, false));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.msl b/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.msl
new file mode 100644
index 0000000..2a1ff4f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = any(bool2(true, false));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.spvasm
new file mode 100644
index 0000000..04cdf1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %10 = OpConstantComposite %v2bool %true %false
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpAny %bool %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.wgsl
new file mode 100644
index 0000000..c83767f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = any(vec2<bool>(true, false));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm
new file mode 100644
index 0000000..ba1e0cc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvLogicalTest_IsInf_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpIsInf %bool %float_50
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..7b8907a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = isinf(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..3573991
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = isinf(50.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..6c8a8fd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpIsInf %bool %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..b943653
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = isInf(50.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm
new file mode 100644
index 0000000..0c5217e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvLogicalTest_IsInf_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpIsInf %v2bool %29
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..15bb43c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = isinf(float2(50.0f, 60.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..4af81bf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = isinf(float2(50.0f, 60.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..04fe779
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %12 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpIsInf %v2bool %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..facbd2c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = isInf(vec2<f32>(50.0, 60.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm
new file mode 100644
index 0000000..9e4cc5e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvLogicalTest_IsNan_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpIsNan %bool %float_50
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..85fcf7b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = isnan(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..0d31ca9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = isnan(50.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..c4dd240
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpIsNan %bool %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..fc8c045
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = isNan(50.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm
new file mode 100644
index 0000000..7b21f37
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvLogicalTest_IsNan_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpIsNan %v2bool %29
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..06437ef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = isnan(float2(50.0f, 60.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..a604594
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = isnan(float2(50.0f, 60.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..76fde65
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %12 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpIsNan %v2bool %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..1542d4b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = isNan(vec2<f32>(50.0, 60.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm
new file mode 100644
index 0000000..59b9a4f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvLogicalTest_Select_BoolCond_BoolParams.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSelect %bool %true %true %false
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.hlsl
new file mode 100644
index 0000000..4cd29eb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (true ? true : false);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.msl b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.msl
new file mode 100644
index 0000000..e9d89bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = select(false, true, true);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.spvasm
new file mode 100644
index 0000000..e4b1526
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpSelect %bool %true %true %false
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.wgsl
new file mode 100644
index 0000000..97b860c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = select(false, true, true);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm
new file mode 100644
index 0000000..e60ca87
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSelect %float %true %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.hlsl
new file mode 100644
index 0000000..44e6747
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_1 = (true ? 50.0f : 60.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.msl b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.msl
new file mode 100644
index 0000000..2357906
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = select(60.0f, 50.0f, true);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.spvasm
new file mode 100644
index 0000000..5a1f1a2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpSelect %float %true %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.wgsl
new file mode 100644
index 0000000..72689b5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : f32 = select(60.0, 50.0, true);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm
new file mode 100644
index 0000000..74fd2ea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSelect %uint %true %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.hlsl
new file mode 100644
index 0000000..30c0b99
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (true ? 10u : 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.msl b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.msl
new file mode 100644
index 0000000..7ca3b5a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = select(20u, 10u, true);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.spvasm
new file mode 100644
index 0000000..49265a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpSelect %uint %true %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.wgsl
new file mode 100644
index 0000000..fcbb222
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = select(20u, 10u, true);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm
new file mode 100644
index 0000000..a7a3b62
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSelect %v2uint %23 %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.hlsl
new file mode 100644
index 0000000..4c97d41
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (bool2(true, false) ? uint2(10u, 20u) : uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.msl b/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.msl
new file mode 100644
index 0000000..385c9c3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = select(uint2(20u, 10u), uint2(10u, 20u), bool2(true, false));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.spvasm
new file mode 100644
index 0000000..dcf2cf7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %12 = OpConstantComposite %v2bool %true %false
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %15 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %16 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpSelect %v2uint %12 %15 %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.wgsl
new file mode 100644
index 0000000..f7b7d94
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = select(vec2<u32>(20u, 10u), vec2<u32>(10u, 20u), vec2<bool>(true, false));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm
new file mode 100644
index 0000000..cbc1de0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm
@@ -0,0 +1,20 @@
+; Test: SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 53
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%_ptr_Workgroup_float = OpTypePointer Workgroup %float
+%52 = OpVariable %_ptr_Workgroup_float Workgroup
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.hlsl
new file mode 100644
index 0000000..5d2e80b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+groupshared float x_52;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.spvasm
new file mode 100644
index 0000000..ce68cdf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_52 "x_52"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %float = OpTypeFloat 32
+%_ptr_Workgroup_float = OpTypePointer Workgroup %float
+ %x_52 = OpVariable %_ptr_Workgroup_float Workgroup
+ %void = OpTypeVoid
+ %4 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %4
+ %7 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %4
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.wgsl
new file mode 100644
index 0000000..dc4d09d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<workgroup> x_52 : f32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm
new file mode 100644
index 0000000..502a434
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm
@@ -0,0 +1,44 @@
+; Test: SpvModuleScopeVarParserTest_ArrayInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Private__arr_uint_uint_2 = OpTypePointer Private %_arr_uint_uint_2
+%uint_2_0 = OpConstant %uint 2
+%29 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2_0
+%200 = OpVariable %_ptr_Private__arr_uint_uint_2 Private %29
+%1 = OpFunction %void None %3
+%30 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..cb7c87e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint x_200[2] = {1u, 2u};
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..4118613
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..e9636c0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_2 ArrayStride 4
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %uint_1 = OpConstant %uint 1
+ %5 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2
+%_ptr_Private__arr_uint_uint_2 = OpTypePointer Private %_arr_uint_uint_2
+ %x_200 = OpVariable %_ptr_Private__arr_uint_uint_2 Private %5
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..9486c7d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_200 : array<u32, 2> = array<u32, 2>(1u, 2u);
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm
new file mode 100644
index 0000000..65efcda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm
@@ -0,0 +1,43 @@
+; Test: SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Private__arr_uint_uint_2 = OpTypePointer Private %_arr_uint_uint_2
+%28 = OpConstantNull %_arr_uint_uint_2
+%200 = OpVariable %_ptr_Private__arr_uint_uint_2 Private %28
+%1 = OpFunction %void None %3
+%29 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..0ef58fb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint x_200[2] = {0u, 0u};
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..4118613
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..b237838
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_2 ArrayStride 4
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %uint_0 = OpConstant %uint 0
+ %5 = OpConstantComposite %_arr_uint_uint_2 %uint_0 %uint_0
+%_ptr_Private__arr_uint_uint_2 = OpTypePointer Private %_arr_uint_uint_2
+ %x_200 = OpVariable %_ptr_Private__arr_uint_uint_2 Private %5
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..83d177a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_200 : array<u32, 2> = array<u32, 2>(0u, 0u);
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm
new file mode 100644
index 0000000..62a885a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 31
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %1 DescriptorSet 0
+OpDecorate %1 Binding 3
+OpDecorate %_struct_3 Block
+OpMemberDecorate %_struct_3 0 Offset 0
+OpMemberDecorate %_struct_3 1 Offset 4
+OpMemberDecorate %_struct_3 2 Offset 8
+OpDecorate %_arr_uint_uint_2 ArrayStride 4
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_3 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3
+%1 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
+%2 = OpFunction %void None %6
+%30 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.hlsl
new file mode 100644
index 0000000..adebfd6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+RWByteAddressBuffer x_1 : register(u3, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.msl
new file mode 100644
index 0000000..fd04641
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ /* 0x0000 */ uint arr[2];
+};
+struct S {
+ /* 0x0000 */ uint field0;
+ /* 0x0004 */ float field1;
+ /* 0x0008 */ tint_array_wrapper field2;
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.spvasm
new file mode 100644
index 0000000..3f2fdf9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.spvasm
@@ -0,0 +1,41 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 2 Offset 8
+ OpDecorate %_arr_uint_uint_2 ArrayStride 4
+ OpDecorate %x_1 DescriptorSet 0
+ OpDecorate %x_1 Binding 3
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %S = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %x_1 = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.wgsl
new file mode 100644
index 0000000..7bf378e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+type Arr = [[stride(4)]] array<u32, 2>;
+
+[[block]]
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : Arr;
+};
+
+[[group(0), binding(3)]] var<storage, read_write> x_1 : S;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm
new file mode 100644
index 0000000..1e23474
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm
@@ -0,0 +1,31 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 901
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %500 "main" %gl_PointSize %gl_Position
+OpDecorate %gl_Position BuiltIn Position
+OpDecorate %gl_PointSize BuiltIn PointSize
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_PointSize = OpVariable %_ptr_Output_float Output
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%_ptr_Private_float = OpTypePointer Private %float
+%900 = OpVariable %_ptr_Private_float Private
+%500 = OpFunction %void None %4
+%13 = OpLabel
+%99 = OpLoad %float %gl_PointSize
+OpStore %900 %99
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.hlsl
new file mode 100644
index 0000000..50204af
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+static float x_900 = 0.0f;
+
+void main_1() {
+ x_900 = 1.0f;
+ return;
+}
+
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol {
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_2};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_2_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.msl
new file mode 100644
index 0000000..97f6e9e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_1 {
+ float4 x_2_1 [[position]];
+};
+
+void main_1(thread float* const tint_symbol_4) {
+ *(tint_symbol_4) = 1.0f;
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float tint_symbol_5 = 0.0f;
+ thread float4 tint_symbol_6 = 0.0f;
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.x_2_1=tint_symbol_6};
+ tint_symbol_1 const tint_symbol_3 = {.x_2_1=tint_symbol_2.x_2_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.spvasm
new file mode 100644
index 0000000..8ad0a08
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.spvasm
@@ -0,0 +1,59 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_2 "x_2"
+ OpName %x_900 "x_900"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_2_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %8 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %8
+%_ptr_Private_float = OpTypePointer Private %float
+ %x_900 = OpVariable %_ptr_Private_float Private %4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %main_out = OpTypeStruct %v4float
+ %18 = OpTypeFunction %void %main_out
+ %main_1 = OpFunction %void None %13
+ %16 = OpLabel
+ OpStore %x_900 %float_1
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %18
+%tint_symbol = OpFunctionParameter %main_out
+ %22 = OpLabel
+ %23 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %23
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %13
+ %25 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %26 = OpFunctionCall %void %main_1
+ %28 = OpLoad %v4float %x_2
+ %29 = OpCompositeConstruct %main_out %28
+ %27 = OpFunctionCall %void %tint_symbol_2 %29
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.wgsl
new file mode 100644
index 0000000..7cca8de
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> x_2 : vec4<f32>;
+
+var<private> x_900 : f32;
+
+fn main_1() {
+ x_900 = 1.0;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_2);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm
new file mode 100644
index 0000000..af26af8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm
@@ -0,0 +1,30 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 501
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %500 "main" %gl_PointSize %gl_Position
+OpDecorate %gl_Position BuiltIn Position
+OpDecorate %gl_PointSize BuiltIn PointSize
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_PointSize = OpVariable %_ptr_Output_float Output
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%_ptr_Output_float_0 = OpTypePointer Output %float
+%float_1 = OpConstant %float 1
+%500 = OpFunction %void None %4
+%14 = OpLabel
+OpStore %gl_PointSize %float_1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.hlsl
new file mode 100644
index 0000000..1993bce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol {
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_2};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_2_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.msl
new file mode 100644
index 0000000..31d7145
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_1 {
+ float4 x_2_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float4 tint_symbol_4 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.x_2_1=tint_symbol_4};
+ tint_symbol_1 const tint_symbol_3 = {.x_2_1=tint_symbol_2.x_2_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.spvasm
new file mode 100644
index 0000000..8c45878
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_2_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %8 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %8
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %15 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %15
+%tint_symbol = OpFunctionParameter %main_out
+ %19 = OpLabel
+ %20 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %22 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %24 = OpFunctionCall %void %main_1
+ %26 = OpLoad %v4float %x_2
+ %27 = OpCompositeConstruct %main_out %26
+ %25 = OpFunctionCall %void %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.wgsl
new file mode 100644
index 0000000..7f989e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> x_2 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_2);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm
new file mode 100644
index 0000000..66cf753
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm
@@ -0,0 +1,31 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 501
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %500 "main" %gl_PointSize %gl_Position
+OpDecorate %gl_Position BuiltIn Position
+OpDecorate %gl_PointSize BuiltIn PointSize
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_PointSize = OpVariable %_ptr_Output_float Output
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%float_1 = OpConstant %float 1
+%500 = OpFunction %void None %4
+%13 = OpLabel
+%100 = OpAccessChain %_ptr_Output_float %gl_PointSize
+%101 = OpCopyObject %_ptr_Output_float %100
+OpStore %101 %float_1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.hlsl
new file mode 100644
index 0000000..1993bce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol {
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_2};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_2_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.msl
new file mode 100644
index 0000000..31d7145
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_1 {
+ float4 x_2_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float4 tint_symbol_4 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.x_2_1=tint_symbol_4};
+ tint_symbol_1 const tint_symbol_3 = {.x_2_1=tint_symbol_2.x_2_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.spvasm
new file mode 100644
index 0000000..8c45878
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_2_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %8 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %8
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %15 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %15
+%tint_symbol = OpFunctionParameter %main_out
+ %19 = OpLabel
+ %20 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %22 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %24 = OpFunctionCall %void %main_1
+ %26 = OpLoad %v4float %x_2
+ %27 = OpCompositeConstruct %main_out %26
+ %25 = OpFunctionCall %void %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.wgsl
new file mode 100644
index 0000000..7f989e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> x_2 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_2);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm
new file mode 100644
index 0000000..8bca660
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm
@@ -0,0 +1,31 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 501
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %500 "main" %gl_PointSize %gl_Position
+OpDecorate %gl_Position BuiltIn Position
+OpDecorate %gl_PointSize BuiltIn PointSize
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_PointSize = OpVariable %_ptr_Output_float Output
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%float_1 = OpConstant %float 1
+%500 = OpFunction %void None %4
+%13 = OpLabel
+%20 = OpCopyObject %_ptr_Output_float %gl_PointSize
+%100 = OpAccessChain %_ptr_Output_float %20
+OpStore %100 %float_1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.hlsl
new file mode 100644
index 0000000..1993bce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol {
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_2};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_2_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.msl
new file mode 100644
index 0000000..31d7145
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_1 {
+ float4 x_2_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float4 tint_symbol_4 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.x_2_1=tint_symbol_4};
+ tint_symbol_1 const tint_symbol_3 = {.x_2_1=tint_symbol_2.x_2_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.spvasm
new file mode 100644
index 0000000..8c45878
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_2_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %8 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %8
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %15 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %15
+%tint_symbol = OpFunctionParameter %main_out
+ %19 = OpLabel
+ %20 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %22 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %24 = OpFunctionCall %void %main_1
+ %26 = OpLoad %v4float %x_2
+ %27 = OpCompositeConstruct %main_out %26
+ %25 = OpFunctionCall %void %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.wgsl
new file mode 100644
index 0000000..7f989e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> x_2 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_2);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm
new file mode 100644
index 0000000..71c0143
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm
@@ -0,0 +1,36 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 901
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %2 "main" %1
+OpMemberDecorate %_struct_10 0 BuiltIn Position
+OpMemberDecorate %_struct_10 1 BuiltIn PointSize
+OpMemberDecorate %_struct_10 2 BuiltIn ClipDistance
+OpMemberDecorate %_struct_10 3 BuiltIn CullDistance
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%_struct_10 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
+%_ptr_Output__struct_10 = OpTypePointer Output %_struct_10
+%1 = OpVariable %_ptr_Output__struct_10 Output
+%_ptr_Output_float = OpTypePointer Output %float
+%14 = OpConstantNull %v4float
+%_ptr_Private_float = OpTypePointer Private %float
+%900 = OpVariable %_ptr_Private_float Private
+%2 = OpFunction %void None %4
+%16 = OpLabel
+%100 = OpAccessChain %_ptr_Output_float %1 %uint_1
+%99 = OpLoad %float %100
+OpStore %900 %99
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.hlsl
new file mode 100644
index 0000000..87eb656
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static float x_900 = 0.0f;
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ x_900 = 1.0f;
+ return;
+}
+
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol {
+ float4 gl_Position : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {gl_Position};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.gl_Position};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.msl
new file mode 100644
index 0000000..12f6b15
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol_1 {
+ float4 gl_Position [[position]];
+};
+
+void main_1(thread float* const tint_symbol_4) {
+ *(tint_symbol_4) = 1.0f;
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float tint_symbol_5 = 0.0f;
+ thread float4 tint_symbol_6 = 0.0f;
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.gl_Position=tint_symbol_6};
+ tint_symbol_1 const tint_symbol_3 = {.gl_Position=tint_symbol_2.gl_Position};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.spvasm
new file mode 100644
index 0000000..7bed4b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.spvasm
@@ -0,0 +1,59 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_900 "x_900"
+ OpName %gl_Position "gl_Position"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "gl_Position"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+%_ptr_Private_float = OpTypePointer Private %float
+ %x_900 = OpVariable %_ptr_Private_float Private %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %10 = OpConstantNull %v4float
+%gl_Position = OpVariable %_ptr_Private_v4float Private %10
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %10
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %main_out = OpTypeStruct %v4float
+ %18 = OpTypeFunction %void %main_out
+ %main_1 = OpFunction %void None %13
+ %16 = OpLabel
+ OpStore %x_900 %float_1
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %18
+%tint_symbol = OpFunctionParameter %main_out
+ %22 = OpLabel
+ %23 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %23
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %13
+ %25 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %26 = OpFunctionCall %void %main_1
+ %28 = OpLoad %v4float %gl_Position
+ %29 = OpCompositeConstruct %main_out %28
+ %27 = OpFunctionCall %void %tint_symbol_2 %29
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.wgsl
new file mode 100644
index 0000000..55cfd34
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> x_900 : f32;
+
+var<private> gl_Position : vec4<f32>;
+
+fn main_1() {
+ x_900 = 1.0;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ gl_Position : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(gl_Position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm
new file mode 100644
index 0000000..abff3db
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm
@@ -0,0 +1,33 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %2 "main" %1
+OpMemberDecorate %_struct_10 0 BuiltIn Position
+OpMemberDecorate %_struct_10 1 BuiltIn PointSize
+OpMemberDecorate %_struct_10 2 BuiltIn ClipDistance
+OpMemberDecorate %_struct_10 3 BuiltIn CullDistance
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%_struct_10 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
+%_ptr_Output__struct_10 = OpTypePointer Output %_struct_10
+%1 = OpVariable %_ptr_Output__struct_10 Output
+%_ptr_Output_float = OpTypePointer Output %float
+%float_1 = OpConstant %float 1
+%2 = OpFunction %void None %4
+%15 = OpLabel
+%100 = OpAccessChain %_ptr_Output_float %1 %uint_1
+OpStore %100 %float_1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.hlsl
new file mode 100644
index 0000000..b773910
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol {
+ float4 gl_Position : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {gl_Position};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.gl_Position};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.msl
new file mode 100644
index 0000000..8e83d1d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol_1 {
+ float4 gl_Position [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float4 tint_symbol_4 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.gl_Position=tint_symbol_4};
+ tint_symbol_1 const tint_symbol_3 = {.gl_Position=tint_symbol_2.gl_Position};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.spvasm
new file mode 100644
index 0000000..26910ee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %gl_Position "gl_Position"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "gl_Position"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %8 = OpConstantNull %v4float
+%gl_Position = OpVariable %_ptr_Private_v4float Private %8
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %15 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %15
+%tint_symbol = OpFunctionParameter %main_out
+ %19 = OpLabel
+ %20 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %22 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %24 = OpFunctionCall %void %main_1
+ %26 = OpLoad %v4float %gl_Position
+ %27 = OpCompositeConstruct %main_out %26
+ %25 = OpFunctionCall %void %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9c43ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> gl_Position : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ gl_Position : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(gl_Position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm
new file mode 100644
index 0000000..38405c5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm
@@ -0,0 +1,34 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 102
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %2 "main" %1
+OpMemberDecorate %_struct_10 0 BuiltIn Position
+OpMemberDecorate %_struct_10 1 BuiltIn PointSize
+OpMemberDecorate %_struct_10 2 BuiltIn ClipDistance
+OpMemberDecorate %_struct_10 3 BuiltIn CullDistance
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%_struct_10 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
+%_ptr_Output__struct_10 = OpTypePointer Output %_struct_10
+%1 = OpVariable %_ptr_Output__struct_10 Output
+%_ptr_Output_float = OpTypePointer Output %float
+%float_1 = OpConstant %float 1
+%2 = OpFunction %void None %4
+%15 = OpLabel
+%100 = OpAccessChain %_ptr_Output_float %1 %uint_1
+%101 = OpCopyObject %_ptr_Output_float %100
+OpStore %101 %float_1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.hlsl
new file mode 100644
index 0000000..b773910
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol {
+ float4 gl_Position : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {gl_Position};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.gl_Position};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.msl
new file mode 100644
index 0000000..8e83d1d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol_1 {
+ float4 gl_Position [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float4 tint_symbol_4 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.gl_Position=tint_symbol_4};
+ tint_symbol_1 const tint_symbol_3 = {.gl_Position=tint_symbol_2.gl_Position};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.spvasm
new file mode 100644
index 0000000..26910ee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %gl_Position "gl_Position"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "gl_Position"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %8 = OpConstantNull %v4float
+%gl_Position = OpVariable %_ptr_Private_v4float Private %8
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %15 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %15
+%tint_symbol = OpFunctionParameter %main_out
+ %19 = OpLabel
+ %20 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %22 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %24 = OpFunctionCall %void %main_1
+ %26 = OpLoad %v4float %gl_Position
+ %27 = OpCompositeConstruct %main_out %26
+ %25 = OpFunctionCall %void %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9c43ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> gl_Position : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ gl_Position : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(gl_Position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm
new file mode 100644
index 0000000..5b3b665
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %2 "main" %1
+OpMemberDecorate %_struct_10 0 BuiltIn Position
+OpMemberDecorate %_struct_10 1 BuiltIn PointSize
+OpMemberDecorate %_struct_10 2 BuiltIn ClipDistance
+OpMemberDecorate %_struct_10 3 BuiltIn CullDistance
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%_struct_10 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
+%_ptr_Output__struct_10 = OpTypePointer Output %_struct_10
+%1 = OpVariable %_ptr_Output__struct_10 Output
+%2 = OpFunction %void None %4
+%13 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.hlsl
new file mode 100644
index 0000000..b773910
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol {
+ float4 gl_Position : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {gl_Position};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.gl_Position};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.msl
new file mode 100644
index 0000000..8e83d1d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol_1 {
+ float4 gl_Position [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float4 tint_symbol_4 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.gl_Position=tint_symbol_4};
+ tint_symbol_1 const tint_symbol_3 = {.gl_Position=tint_symbol_2.gl_Position};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.spvasm
new file mode 100644
index 0000000..26910ee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %gl_Position "gl_Position"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "gl_Position"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %8 = OpConstantNull %v4float
+%gl_Position = OpVariable %_ptr_Private_v4float Private %8
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %15 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %15
+%tint_symbol = OpFunctionParameter %main_out
+ %19 = OpLabel
+ %20 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %22 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %24 = OpFunctionCall %void %main_1
+ %26 = OpLoad %v4float %gl_Position
+ %27 = OpCompositeConstruct %main_out %26
+ %25 = OpFunctionCall %void %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9c43ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> gl_Position : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ gl_Position : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(gl_Position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm
new file mode 100644
index 0000000..af425d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm
@@ -0,0 +1,40 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 25
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %2 "main" %1
+OpMemberDecorate %_struct_10 0 BuiltIn Position
+OpMemberDecorate %_struct_10 1 BuiltIn PointSize
+OpMemberDecorate %_struct_10 2 BuiltIn ClipDistance
+OpMemberDecorate %_struct_10 3 BuiltIn CullDistance
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%_struct_10 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
+%_ptr_Output__struct_10 = OpTypePointer Output %_struct_10
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_5 = OpConstant %float 5
+%float_6 = OpConstant %float 6
+%float_7 = OpConstant %float 7
+%20 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%21 = OpConstantComposite %_arr_float_uint_1 %float_6
+%22 = OpConstantComposite %_arr_float_uint_1 %float_7
+%23 = OpConstantComposite %_struct_10 %20 %float_5 %21 %22
+%1 = OpVariable %_ptr_Output__struct_10 Output %23
+%2 = OpFunction %void None %4
+%24 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..ca9f014
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static float4 gl_Position = float4(1.0f, 2.0f, 3.0f, 4.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol {
+ float4 gl_Position : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {gl_Position};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.gl_Position};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.msl
new file mode 100644
index 0000000..09a24c3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol_1 {
+ float4 gl_Position [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float4 tint_symbol_4 = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ main_1();
+ main_out const tint_symbol_2 = {.gl_Position=tint_symbol_4};
+ tint_symbol_1 const tint_symbol_3 = {.gl_Position=tint_symbol_2.gl_Position};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..dfb0c5d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.spvasm
@@ -0,0 +1,59 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %gl_Position "gl_Position"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "gl_Position"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+ %float_1 = OpConstant %float 1
+ %float_2 = OpConstant %float 2
+ %float_3 = OpConstant %float 3
+ %float_4 = OpConstant %float 4
+ %10 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+%gl_Position = OpVariable %_ptr_Private_v4float Private %10
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %15 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %20 = OpTypeFunction %void %main_out
+ %main_1 = OpFunction %void None %16
+ %19 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %20
+%tint_symbol = OpFunctionParameter %main_out
+ %24 = OpLabel
+ %25 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %25
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %16
+ %27 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %28 = OpFunctionCall %void %main_1
+ %30 = OpLoad %v4float %gl_Position
+ %31 = OpCompositeConstruct %main_out %30
+ %29 = OpFunctionCall %void %tint_symbol_2 %31
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..ed9859a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> gl_Position : vec4<f32> = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ gl_Position : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(gl_Position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm
new file mode 100644
index 0000000..6ef0c06
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm
@@ -0,0 +1,33 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %2 "main" %1
+OpMemberDecorate %_struct_10 0 BuiltIn Position
+OpMemberDecorate %_struct_10 1 BuiltIn PointSize
+OpMemberDecorate %_struct_10 2 BuiltIn ClipDistance
+OpMemberDecorate %_struct_10 3 BuiltIn CullDistance
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%_struct_10 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
+%_ptr_Output__struct_10 = OpTypePointer Output %_struct_10
+%1 = OpVariable %_ptr_Output__struct_10 Output
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%14 = OpConstantNull %v4float
+%2 = OpFunction %void None %4
+%15 = OpLabel
+%100 = OpAccessChain %_ptr_Output_v4float %1 %uint_0
+OpStore %100 %14
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.hlsl
new file mode 100644
index 0000000..05826f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol {
+ float4 gl_Position : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {gl_Position};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.gl_Position};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.msl
new file mode 100644
index 0000000..cbba940
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol_1 {
+ float4 gl_Position [[position]];
+};
+
+void main_1(thread float4* const tint_symbol_4) {
+ *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float4 tint_symbol_5 = 0.0f;
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.gl_Position=tint_symbol_5};
+ tint_symbol_1 const tint_symbol_3 = {.gl_Position=tint_symbol_2.gl_Position};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.spvasm
new file mode 100644
index 0000000..e96f80d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.spvasm
@@ -0,0 +1,58 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %gl_Position "gl_Position"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "gl_Position"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %8 = OpConstantNull %v4float
+%gl_Position = OpVariable %_ptr_Private_v4float Private %8
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %float_0 = OpConstant %float 0
+ %16 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+ %main_out = OpTypeStruct %v4float
+ %17 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ OpStore %gl_Position %16
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %17
+%tint_symbol = OpFunctionParameter %main_out
+ %21 = OpLabel
+ %22 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %22
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %24 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %26 = OpFunctionCall %void %main_1
+ %28 = OpLoad %v4float %gl_Position
+ %29 = OpCompositeConstruct %main_out %28
+ %27 = OpFunctionCall %void %tint_symbol_2 %29
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.wgsl
new file mode 100644
index 0000000..45b705f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> gl_Position : vec4<f32>;
+
+fn main_1() {
+ gl_Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ gl_Position : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(gl_Position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm
new file mode 100644
index 0000000..7622305
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm
@@ -0,0 +1,33 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %2 "main" %1
+OpMemberDecorate %_struct_10 0 BuiltIn Position
+OpMemberDecorate %_struct_10 1 BuiltIn PointSize
+OpMemberDecorate %_struct_10 2 BuiltIn ClipDistance
+OpMemberDecorate %_struct_10 3 BuiltIn CullDistance
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%_struct_10 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
+%_ptr_Output__struct_10 = OpTypePointer Output %_struct_10
+%1 = OpVariable %_ptr_Output__struct_10 Output
+%_ptr_Output_float = OpTypePointer Output %float
+%14 = OpConstantNull %float
+%2 = OpFunction %void None %4
+%15 = OpLabel
+%100 = OpAccessChain %_ptr_Output_float %1 %uint_0 %uint_1
+OpStore %100 %14
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..6ce5943
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ gl_Position.y = 0.0f;
+ return;
+}
+
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol {
+ float4 gl_Position : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {gl_Position};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.gl_Position};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..cd58c78
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol_1 {
+ float4 gl_Position [[position]];
+};
+
+void main_1(thread float4* const tint_symbol_4) {
+ (*(tint_symbol_4)).y = 0.0f;
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float4 tint_symbol_5 = 0.0f;
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.gl_Position=tint_symbol_5};
+ tint_symbol_1 const tint_symbol_3 = {.gl_Position=tint_symbol_2.gl_Position};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..3589285
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.spvasm
@@ -0,0 +1,61 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %gl_Position "gl_Position"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "gl_Position"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %8 = OpConstantNull %v4float
+%gl_Position = OpVariable %_ptr_Private_v4float Private %8
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Private_float = OpTypePointer Private %float
+ %float_0 = OpConstant %float 0
+ %main_out = OpTypeStruct %v4float
+ %20 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ %18 = OpAccessChain %_ptr_Private_float %gl_Position %uint_1
+ OpStore %18 %float_0
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %20
+%tint_symbol = OpFunctionParameter %main_out
+ %24 = OpLabel
+ %25 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %25
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %27 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %29 = OpFunctionCall %void %main_1
+ %31 = OpLoad %v4float %gl_Position
+ %32 = OpCompositeConstruct %main_out %31
+ %30 = OpFunctionCall %void %tint_symbol_2 %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..45d50df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> gl_Position : vec4<f32>;
+
+fn main_1() {
+ gl_Position.y = 0.0;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ gl_Position : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(gl_Position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm
new file mode 100644
index 0000000..65b6be0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm
@@ -0,0 +1,35 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 102
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %2 "main" %1
+OpMemberDecorate %_struct_10 0 BuiltIn Position
+OpMemberDecorate %_struct_10 1 BuiltIn PointSize
+OpMemberDecorate %_struct_10 2 BuiltIn ClipDistance
+OpMemberDecorate %_struct_10 3 BuiltIn CullDistance
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%_struct_10 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
+%_ptr_Output__struct_10 = OpTypePointer Output %_struct_10
+%1 = OpVariable %_ptr_Output__struct_10 Output
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%_ptr_Output_float = OpTypePointer Output %float
+%15 = OpConstantNull %float
+%2 = OpFunction %void None %4
+%16 = OpLabel
+%100 = OpAccessChain %_ptr_Output_v4float %1 %uint_0
+%101 = OpAccessChain %_ptr_Output_float %100 %uint_1
+OpStore %101 %15
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..6ce5943
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ gl_Position.y = 0.0f;
+ return;
+}
+
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol {
+ float4 gl_Position : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {gl_Position};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.gl_Position};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..cd58c78
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol_1 {
+ float4 gl_Position [[position]];
+};
+
+void main_1(thread float4* const tint_symbol_4) {
+ (*(tint_symbol_4)).y = 0.0f;
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float4 tint_symbol_5 = 0.0f;
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.gl_Position=tint_symbol_5};
+ tint_symbol_1 const tint_symbol_3 = {.gl_Position=tint_symbol_2.gl_Position};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..3589285
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.spvasm
@@ -0,0 +1,61 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %gl_Position "gl_Position"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "gl_Position"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %8 = OpConstantNull %v4float
+%gl_Position = OpVariable %_ptr_Private_v4float Private %8
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Private_float = OpTypePointer Private %float
+ %float_0 = OpConstant %float 0
+ %main_out = OpTypeStruct %v4float
+ %20 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ %18 = OpAccessChain %_ptr_Private_float %gl_Position %uint_1
+ OpStore %18 %float_0
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %20
+%tint_symbol = OpFunctionParameter %main_out
+ %24 = OpLabel
+ %25 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %25
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %27 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %29 = OpFunctionCall %void %main_1
+ %31 = OpLoad %v4float %gl_Position
+ %32 = OpCompositeConstruct %main_out %31
+ %30 = OpFunctionCall %void %tint_symbol_2 %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..45d50df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> gl_Position : vec4<f32>;
+
+fn main_1() {
+ gl_Position.y = 0.0;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ gl_Position : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(gl_Position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm
new file mode 100644
index 0000000..c1bffe5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm
@@ -0,0 +1,34 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %2 "main" %1
+OpMemberDecorate %_struct_10 0 BuiltIn ClipDistance
+OpMemberDecorate %_struct_10 1 BuiltIn CullDistance
+OpMemberDecorate %_struct_10 2 BuiltIn Position
+OpMemberDecorate %_struct_10 3 BuiltIn PointSize
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%_struct_10 = OpTypeStruct %_arr_float_uint_1 %_arr_float_uint_1 %v4float %float
+%_ptr_Output__struct_10 = OpTypePointer Output %_struct_10
+%1 = OpVariable %_ptr_Output__struct_10 Output
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%15 = OpConstantNull %v4float
+%2 = OpFunction %void None %4
+%16 = OpLabel
+%100 = OpAccessChain %_ptr_Output_v4float %1 %uint_2
+OpStore %100 %15
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.hlsl
new file mode 100644
index 0000000..05826f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol {
+ float4 gl_Position : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {gl_Position};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.gl_Position};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.msl
new file mode 100644
index 0000000..cbba940
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 gl_Position;
+};
+struct tint_symbol_1 {
+ float4 gl_Position [[position]];
+};
+
+void main_1(thread float4* const tint_symbol_4) {
+ *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float4 tint_symbol_5 = 0.0f;
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.gl_Position=tint_symbol_5};
+ tint_symbol_1 const tint_symbol_3 = {.gl_Position=tint_symbol_2.gl_Position};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.spvasm
new file mode 100644
index 0000000..e96f80d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.spvasm
@@ -0,0 +1,58 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %gl_Position "gl_Position"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "gl_Position"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %8 = OpConstantNull %v4float
+%gl_Position = OpVariable %_ptr_Private_v4float Private %8
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %float_0 = OpConstant %float 0
+ %16 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
+ %main_out = OpTypeStruct %v4float
+ %17 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ OpStore %gl_Position %16
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %17
+%tint_symbol = OpFunctionParameter %main_out
+ %21 = OpLabel
+ %22 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %22
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %24 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %26 = OpFunctionCall %void %main_1
+ %28 = OpLoad %v4float %gl_Position
+ %29 = OpCompositeConstruct %main_out %28
+ %27 = OpFunctionCall %void %tint_symbol_2 %29
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.wgsl
new file mode 100644
index 0000000..45b705f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> gl_Position : vec4<f32>;
+
+fn main_1() {
+ gl_Position = vec4<f32>(0.0, 0.0, 0.0, 0.0);
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ gl_Position : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(gl_Position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm
new file mode 100644
index 0000000..582eeb3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm
@@ -0,0 +1,26 @@
+; Test: SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 53
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %1 "main" %gl_VertexIndex %position
+OpName %position "position"
+OpDecorate %position BuiltIn Position
+OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+%uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_VertexIndex = OpVariable %_ptr_Input_uint Input
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%position = OpVariable %_ptr_Output_v4float Output
+%1 = OpFunction %void None %6
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.hlsl
new file mode 100644
index 0000000..1e520e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.hlsl
@@ -0,0 +1,25 @@
+static uint x_2 = 0u;
+static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_1 {
+ uint x_2_param : SV_VertexID;
+};
+struct tint_symbol_2 {
+ float4 position_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_2_param = tint_symbol.x_2_param;
+ x_2 = x_2_param;
+ main_1();
+ const main_out tint_symbol_3 = {position};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.msl
new file mode 100644
index 0000000..bb4bf26
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_2 {
+ float4 position_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_2_param [[vertex_id]]) {
+ thread uint tint_symbol_5 = 0u;
+ thread float4 tint_symbol_6 = 0.0f;
+ tint_symbol_5 = x_2_param;
+ main_1();
+ main_out const tint_symbol_3 = {.position_1=tint_symbol_6};
+ tint_symbol_2 const tint_symbol_4 = {.position_1=tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.spvasm
new file mode 100644
index 0000000..2cacf7fc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_2 "x_2"
+ OpName %position "position"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "position_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn VertexIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %8 = OpConstantNull %uint
+ %x_2 = OpVariable %_ptr_Private_uint Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %position = OpVariable %_ptr_Private_v4float Private %12
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %21 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %21
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %25 = OpLabel
+ %26 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %28 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %30 = OpLoad %uint %tint_symbol
+ OpStore %x_2 %30
+ %31 = OpFunctionCall %void %main_1
+ %33 = OpLoad %v4float %position
+ %34 = OpCompositeConstruct %main_out %33
+ %32 = OpFunctionCall %void %tint_symbol_3 %34
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.wgsl
new file mode 100644
index 0000000..1c1e5b8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> x_2 : u32;
+
+var<private> position : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ position_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(vertex_index)]] x_2_param : u32) -> main_out {
+ x_2 = x_2_param;
+ main_1();
+ return main_out(position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm
new file mode 100644
index 0000000..2867363
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm
@@ -0,0 +1,43 @@
+; Test: SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 30
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_VertexIndex = OpVariable %_ptr_Input_int Input
+%2 = OpFunction %void None %4
+%29 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.hlsl
new file mode 100644
index 0000000..ff4c73d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static int x_1 = 0;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.spvasm
new file mode 100644
index 0000000..54f15f9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %4 = OpConstantNull %int
+ %x_1 = OpVariable %_ptr_Private_int Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.wgsl
new file mode 100644
index 0000000..6526967
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_1 : i32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm
new file mode 100644
index 0000000..f13e790
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm
@@ -0,0 +1,43 @@
+; Test: SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 30
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_VertexIndex = OpVariable %_ptr_Input_uint Input
+%2 = OpFunction %void None %4
+%29 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.hlsl
new file mode 100644
index 0000000..415c810
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint x_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.spvasm
new file mode 100644
index 0000000..de87216
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.wgsl
new file mode 100644
index 0000000..21b73b3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm
new file mode 100644
index 0000000..3d574a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 32
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_ptr_Output__arr_int_uint_1 = OpTypePointer Output %_arr_int_uint_1
+%30 = OpConstantComposite %_arr_int_uint_1 %int_14
+%gl_SampleMask = OpVariable %_ptr_Output__arr_int_uint_1 Output %30
+%2 = OpFunction %void None %4
+%31 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.hlsl
new file mode 100644
index 0000000..542b23f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static int x_1[1] = {14};
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.msl
new file mode 100644
index 0000000..2dea471
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ int arr[1];
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.spvasm
new file mode 100644
index 0000000..eb3e1f2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_int_uint_1 ArrayStride 4
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+ %int_14 = OpConstant %int 14
+ %6 = OpConstantComposite %_arr_int_uint_1 %int_14
+%_ptr_Private__arr_int_uint_1 = OpTypePointer Private %_arr_int_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_int_uint_1 Private %6
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.wgsl
new file mode 100644
index 0000000..005f56f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_1 : array<i32, 1> = array<i32, 1>(14);
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm
new file mode 100644
index 0000000..b5b0d32
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 32
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%30 = OpConstantComposite %_arr_uint_uint_1 %uint_2
+%gl_SampleMask = OpVariable %_ptr_Output__arr_uint_uint_1 Output %30
+%2 = OpFunction %void None %4
+%31 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.hlsl
new file mode 100644
index 0000000..f8d7e81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint x_1[1] = {2u};
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.msl
new file mode 100644
index 0000000..1a7edff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[1];
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.spvasm
new file mode 100644
index 0000000..cb40bb0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+ %uint_2 = OpConstant %uint 2
+ %5 = OpConstantComposite %_arr_uint_uint_1 %uint_2
+%_ptr_Private__arr_uint_uint_1 = OpTypePointer Private %_arr_uint_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_uint_uint_1 Private %5
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.wgsl
new file mode 100644
index 0000000..1e6a354
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_1 : array<u32, 1> = array<u32, 1>(2u);
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm
new file mode 100644
index 0000000..e43402c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm
@@ -0,0 +1,30 @@
+; Test: SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 11
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %myvar "myvar"
+OpDecorate %myvar DescriptorSet 0
+OpDecorate %myvar Binding 0
+OpDecorate %_struct_3 Block
+OpMemberDecorate %_struct_3 0 ColMajor
+OpMemberDecorate %_struct_3 0 Offset 0
+OpMemberDecorate %_struct_3 0 MatrixStride 8
+%float = OpTypeFloat 32
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%_struct_3 = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3
+%myvar = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
+%void = OpTypeVoid
+%9 = OpTypeFunction %void
+%1 = OpFunction %void None %9
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.hlsl
new file mode 100644
index 0000000..ef0855d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+RWByteAddressBuffer myvar : register(u0, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.msl
new file mode 100644
index 0000000..ecdf927
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ /* 0x0000 */ float3x2 field0;
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.spvasm
new file mode 100644
index 0000000..64446e5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 0 ColMajor
+ OpMemberDecorate %S 0 MatrixStride 8
+ OpDecorate %myvar DescriptorSet 0
+ OpDecorate %myvar Binding 0
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+ %S = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %myvar = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.wgsl
new file mode 100644
index 0000000..79b8f48
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+[[block]]
+struct S {
+ field0 : mat3x2<f32>;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm
new file mode 100644
index 0000000..62120a6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 31
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+OpMemberDecorate %_struct_3 0 Offset 0
+OpMemberDecorate %_struct_3 1 Offset 4
+OpMemberDecorate %_struct_3 2 Offset 8
+OpDecorate %_arr_uint_uint_2 ArrayStride 4
+OpDecorate %1 DescriptorSet 3
+OpDecorate %1 Binding 9
+OpDecorate %_struct_3 Block
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_3 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3
+%1 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
+%2 = OpFunction %void None %6
+%30 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.hlsl
new file mode 100644
index 0000000..734ada3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+RWByteAddressBuffer x_1 : register(u9, space3);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.msl
new file mode 100644
index 0000000..fd04641
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ /* 0x0000 */ uint arr[2];
+};
+struct S {
+ /* 0x0000 */ uint field0;
+ /* 0x0004 */ float field1;
+ /* 0x0008 */ tint_array_wrapper field2;
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.spvasm
new file mode 100644
index 0000000..2abc2d9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.spvasm
@@ -0,0 +1,41 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 2 Offset 8
+ OpDecorate %_arr_uint_uint_2 ArrayStride 4
+ OpDecorate %x_1 DescriptorSet 3
+ OpDecorate %x_1 Binding 9
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %S = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %x_1 = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.wgsl
new file mode 100644
index 0000000..c732065
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+type Arr = [[stride(4)]] array<u32, 2>;
+
+[[block]]
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : Arr;
+};
+
+[[group(3), binding(9)]] var<storage, read_write> x_1 : S;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm
new file mode 100644
index 0000000..3e321c5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm
@@ -0,0 +1,44 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 30
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main" %gl_FragDepth
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %gl_FragDepth BuiltIn FragDepth
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Output_float = OpTypePointer Output %float
+%gl_FragDepth = OpVariable %_ptr_Output_float Output %float_0
+%2 = OpFunction %void None %4
+%29 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..592cc40
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static float x_1 = 0.0f;
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float x_1_1;
+};
+struct tint_symbol {
+ float x_1_1 : SV_Depth;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_1};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.msl
new file mode 100644
index 0000000..4792818
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float x_1_1;
+};
+struct tint_symbol_1 {
+ float x_1_1 [[depth(any)]];
+};
+
+void main_1() {
+ return;
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ thread float tint_symbol_4 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.x_1_1=tint_symbol_4};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..9823b0d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.spvasm
@@ -0,0 +1,50 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol_1
+ OpExecutionMode %main OriginUpperLeft
+ OpExecutionMode %main DepthReplacing
+ OpName %x_1 "x_1"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_symbol_1 BuiltIn FragDepth
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+ %float_0 = OpConstant %float 0
+%_ptr_Private_float = OpTypePointer Private %float
+ %x_1 = OpVariable %_ptr_Private_float Private %float_0
+%_ptr_Output_float = OpTypePointer Output %float
+ %7 = OpConstantNull %float
+%tint_symbol_1 = OpVariable %_ptr_Output_float Output %7
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_out = OpTypeStruct %float
+ %12 = OpTypeFunction %void %main_out
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %12
+%tint_symbol = OpFunctionParameter %main_out
+ %16 = OpLabel
+ %17 = OpCompositeExtract %float %tint_symbol 0
+ OpStore %tint_symbol_1 %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ %22 = OpLoad %float %x_1
+ %23 = OpCompositeConstruct %main_out %22
+ %21 = OpFunctionCall %void %tint_symbol_2 %23
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..b1cced5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> x_1 : f32 = 0.0;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(frag_depth)]]
+ x_1_1 : f32;
+};
+
+[[stage(fragment)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_1);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm
new file mode 100644
index 0000000..f52b885
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm
@@ -0,0 +1,47 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 33
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %gl_Position %gl_InstanceIndex
+OpDecorate %gl_Position BuiltIn Position
+OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_InstanceIndex = OpVariable %_ptr_Input_int Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%32 = OpLabel
+%2 = OpLoad %int %gl_InstanceIndex
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.hlsl
new file mode 100644
index 0000000..5aaa5ee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static int x_4 = 0;
+static float4 x_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const int x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_InstanceID;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = asint(x_4_param);
+ main_1();
+ const main_out tint_symbol_3 = {x_1};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.msl
new file mode 100644
index 0000000..c87d85b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 [[position]];
+};
+
+void main_1(thread int* const tint_symbol_5) {
+ int const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[instance_id]]) {
+ thread int tint_symbol_6 = 0;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = as_type<int>(x_4_param);
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.x_1_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.x_1_1=tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.spvasm
new file mode 100644
index 0000000..7d9858e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn InstanceIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %8 = OpConstantNull %int
+ %x_4 = OpVariable %_ptr_Private_int Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %x_1 = OpVariable %_ptr_Private_v4float Private %12
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %18 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %23 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %18
+ %21 = OpLabel
+ %22 = OpLoad %int %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %23
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %27 = OpLabel
+ %28 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %18
+ %30 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %33 = OpLoad %uint %tint_symbol
+ %32 = OpBitcast %int %33
+ OpStore %x_4 %32
+ %34 = OpFunctionCall %void %main_1
+ %36 = OpLoad %v4float %x_1
+ %37 = OpCompositeConstruct %main_out %36
+ %35 = OpFunctionCall %void %tint_symbol_3 %37
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.wgsl
new file mode 100644
index 0000000..4d89296
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> x_4 : i32;
+
+var<private> x_1 : vec4<f32>;
+
+fn main_1() {
+ let x_2 : i32 = x_4;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_1_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(instance_index)]] x_4_param : u32) -> main_out {
+ x_4 = bitcast<i32>(x_4_param);
+ main_1();
+ return main_out(x_1);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm
new file mode 100644
index 0000000..4d554aa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm
@@ -0,0 +1,47 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 33
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %gl_InstanceIndex %gl_Position
+OpDecorate %gl_Position BuiltIn Position
+OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_InstanceIndex = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%32 = OpLabel
+%2 = OpLoad %uint %gl_InstanceIndex
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.hlsl
new file mode 100644
index 0000000..0d3adff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint x_1 = 0u;
+static float4 x_4 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const uint x_2 = x_1;
+ return;
+}
+
+struct main_out {
+ float4 x_4_1;
+};
+struct tint_symbol_1 {
+ uint x_1_param : SV_InstanceID;
+};
+struct tint_symbol_2 {
+ float4 x_4_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ const main_out tint_symbol_3 = {x_4};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_4_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.msl
new file mode 100644
index 0000000..3a92aaa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_4_1;
+};
+struct tint_symbol_2 {
+ float4 x_4_1 [[position]];
+};
+
+void main_1(thread uint* const tint_symbol_5) {
+ uint const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_1_param [[instance_id]]) {
+ thread uint tint_symbol_6 = 0u;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = x_1_param;
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.x_4_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.x_4_1=tint_symbol_3.x_4_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.spvasm
new file mode 100644
index 0000000..841fa48
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_1 "x_1"
+ OpName %x_4 "x_4"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_4_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn InstanceIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %8 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %x_4 = OpVariable %_ptr_Private_v4float Private %12
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %22 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ %21 = OpLoad %uint %x_1
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %22
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %26 = OpLabel
+ %27 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %29 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %31 = OpLoad %uint %tint_symbol
+ OpStore %x_1 %31
+ %32 = OpFunctionCall %void %main_1
+ %34 = OpLoad %v4float %x_4
+ %35 = OpCompositeConstruct %main_out %34
+ %33 = OpFunctionCall %void %tint_symbol_3 %35
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.wgsl
new file mode 100644
index 0000000..0258417
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> x_1 : u32;
+
+var<private> x_4 : vec4<f32>;
+
+fn main_1() {
+ let x_2 : u32 = x_1;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_4_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
+ x_1 = x_1_param;
+ main_1();
+ return main_out(x_4);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm
new file mode 100644
index 0000000..ebd915b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 31
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main" %gl_SampleMask
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_ptr_Input__arr_int_uint_1 = OpTypePointer Input %_arr_int_uint_1
+%gl_SampleMask = OpVariable %_ptr_Input__arr_int_uint_1 Input
+%2 = OpFunction %void None %4
+%30 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.hlsl
new file mode 100644
index 0000000..1956d46
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static int x_1[1] = (int[1])0;
+
+void main_1() {
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_Coverage;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1[0] = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.msl
new file mode 100644
index 0000000..17039f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ int arr[1];
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_mask]]) {
+ thread tint_array_wrapper tint_symbol_2 = {};
+ tint_symbol_2.arr[0] = as_type<int>(x_1_param);
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.spvasm
new file mode 100644
index 0000000..c921467
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_int_uint_1 ArrayStride 4
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol BuiltIn SampleMask
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_ptr_Private__arr_int_uint_1 = OpTypePointer Private %_arr_int_uint_1
+ %7 = OpConstantNull %_arr_int_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_int_uint_1 Private %7
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%tint_symbol = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %int_0 = OpConstant %int 0
+%_ptr_Private_int = OpTypePointer Private %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %16 = OpLabel
+ %19 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ %22 = OpAccessChain %_ptr_Input_uint %tint_symbol %int_0
+ %23 = OpLoad %uint %22
+ %20 = OpBitcast %int %23
+ OpStore %19 %20
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.wgsl
new file mode 100644
index 0000000..a4ecdbb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+var<private> x_1 : array<i32, 1>;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_mask)]] x_1_param : u32) {
+ x_1[0] = bitcast<i32>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm
new file mode 100644
index 0000000..d8324dc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 31
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main" %gl_SampleMask
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%gl_SampleMask = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+%2 = OpFunction %void None %4
+%30 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..ae1dd89
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint x_1[1] = (uint[1])0;
+
+void main_1() {
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_Coverage;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1[0] = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.msl
new file mode 100644
index 0000000..03c6bea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[1];
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_mask]]) {
+ thread tint_array_wrapper tint_symbol_2 = {};
+ tint_symbol_2.arr[0] = x_1_param;
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..0b52389
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol BuiltIn SampleMask
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Private__arr_uint_uint_1 = OpTypePointer Private %_arr_uint_uint_1
+ %6 = OpConstantNull %_arr_uint_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_uint_uint_1 Private %6
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%tint_symbol = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Input_uint = OpTypePointer Input %uint
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %14 = OpLabel
+ %18 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %20 = OpAccessChain %_ptr_Input_uint %tint_symbol %int_0
+ %21 = OpLoad %uint %20
+ OpStore %18 %21
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..9850594
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+var<private> x_1 : array<u32, 1>;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_mask)]] x_1_param : u32) {
+ x_1[0] = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm
new file mode 100644
index 0000000..4c761ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 32
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main" %gl_SampleMask
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_ptr_Output__arr_int_uint_1 = OpTypePointer Output %_arr_int_uint_1
+%30 = OpConstantNull %_arr_int_uint_1
+%gl_SampleMask = OpVariable %_ptr_Output__arr_int_uint_1 Output %30
+%2 = OpFunction %void None %4
+%31 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..19fa549
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static int x_1[1] = {0};
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol {
+ uint x_1_1 : SV_Coverage;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {asuint(x_1[0])};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.msl
new file mode 100644
index 0000000..2073b56
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ int arr[1];
+};
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_1_1 [[sample_mask]];
+};
+
+void main_1() {
+ return;
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ thread tint_array_wrapper tint_symbol_4 = {.arr={0}};
+ main_1();
+ main_out const tint_symbol_2 = {.x_1_1=as_type<uint>(tint_symbol_4.arr[0])};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..a8e50ce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.spvasm
@@ -0,0 +1,61 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol_1
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %_arr_int_uint_1 ArrayStride 4
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol_1 BuiltIn SampleMask
+ OpMemberDecorate %main_out 0 Offset 0
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+ %int_0 = OpConstant %int 0
+ %6 = OpConstantComposite %_arr_int_uint_1 %int_0
+%_ptr_Private__arr_int_uint_1 = OpTypePointer Private %_arr_int_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_int_uint_1 Private %6
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+ %12 = OpConstantNull %_arr_uint_uint_1
+%tint_symbol_1 = OpVariable %_ptr_Output__arr_uint_uint_1 Output %12
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %main_out = OpTypeStruct %uint
+ %17 = OpTypeFunction %void %main_out
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Private_int = OpTypePointer Private %int
+ %main_1 = OpFunction %void None %13
+ %16 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %17
+%tint_symbol = OpFunctionParameter %main_out
+ %21 = OpLabel
+ %23 = OpAccessChain %_ptr_Output_uint %tint_symbol_1 %int_0
+ %24 = OpCompositeExtract %uint %tint_symbol 0
+ OpStore %23 %24
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %13
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %main_1
+ %31 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ %32 = OpLoad %int %31
+ %29 = OpBitcast %uint %32
+ %33 = OpCompositeConstruct %main_out %29
+ %28 = OpFunctionCall %void %tint_symbol_2 %33
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..48a29f6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> x_1 : array<i32, 1> = array<i32, 1>(0);
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(sample_mask)]]
+ x_1_1 : u32;
+};
+
+[[stage(fragment)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(bitcast<u32>(x_1[0]));
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm
new file mode 100644
index 0000000..a1a5af6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 32
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main" %gl_SampleMask
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%30 = OpConstantNull %_arr_uint_uint_1
+%gl_SampleMask = OpVariable %_ptr_Output__arr_uint_uint_1 Output %30
+%2 = OpFunction %void None %4
+%31 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..db4a8bc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint x_1[1] = {0u};
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol {
+ uint x_1_1 : SV_Coverage;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_1[0]};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.msl
new file mode 100644
index 0000000..a09d091
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[1];
+};
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_1_1 [[sample_mask]];
+};
+
+void main_1() {
+ return;
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ thread tint_array_wrapper tint_symbol_4 = {.arr={0u}};
+ main_1();
+ main_out const tint_symbol_2 = {.x_1_1=tint_symbol_4.arr[0]};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..d95cd17
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.spvasm
@@ -0,0 +1,59 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol_1
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol_1 BuiltIn SampleMask
+ OpMemberDecorate %main_out 0 Offset 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+ %uint_0 = OpConstant %uint 0
+ %5 = OpConstantComposite %_arr_uint_uint_1 %uint_0
+%_ptr_Private__arr_uint_uint_1 = OpTypePointer Private %_arr_uint_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_uint_uint_1 Private %5
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+ %10 = OpConstantNull %_arr_uint_uint_1
+%tint_symbol_1 = OpVariable %_ptr_Output__arr_uint_uint_1 Output %10
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %main_out = OpTypeStruct %uint
+ %15 = OpTypeFunction %void %main_out
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %15
+%tint_symbol = OpFunctionParameter %main_out
+ %19 = OpLabel
+ %23 = OpAccessChain %_ptr_Output_uint %tint_symbol_1 %int_0
+ %24 = OpCompositeExtract %uint %tint_symbol 0
+ OpStore %23 %24
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %main_1
+ %30 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %31 = OpLoad %uint %30
+ %32 = OpCompositeConstruct %main_out %31
+ %28 = OpFunctionCall %void %tint_symbol_2 %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..1011156
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> x_1 : array<u32, 1> = array<u32, 1>(0u);
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(sample_mask)]]
+ x_1_1 : u32;
+};
+
+[[stage(fragment)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_1[0]);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm
new file mode 100644
index 0000000..adc2370
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 34
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %3 "main" %1 %2
+OpExecutionMode %3 OriginUpperLeft
+OpDecorate %1 Location 1
+OpDecorate %2 Location 5
+OpDecorate %1 Flat
+OpDecorate %2 Flat
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_float_uint_2 = OpTypeArray %float %uint_2
+%_struct_30 = OpTypeStruct %float %float
+%_ptr_Input__arr_float_uint_2 = OpTypePointer Input %_arr_float_uint_2
+%_ptr_Input__struct_30 = OpTypePointer Input %_struct_30
+%1 = OpVariable %_ptr_Input__arr_float_uint_2 Input
+%2 = OpVariable %_ptr_Input__struct_30 Input
+%3 = OpFunction %void None %5
+%33 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.hlsl
new file mode 100644
index 0000000..8aa1229
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.hlsl
@@ -0,0 +1,31 @@
+struct S {
+ float field0;
+ float field1;
+};
+
+static float x_1[2] = (float[2])0;
+static S x_2 = (S)0;
+
+void main_1() {
+ return;
+}
+
+struct tint_symbol_1 {
+ nointerpolation float x_1_param : TEXCOORD1;
+ nointerpolation float x_1_param_1 : TEXCOORD2;
+ nointerpolation float x_2_param : TEXCOORD5;
+ nointerpolation float x_2_param_1 : TEXCOORD6;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const float x_1_param = tint_symbol.x_1_param;
+ const float x_1_param_1 = tint_symbol.x_1_param_1;
+ const float x_2_param = tint_symbol.x_2_param;
+ const float x_2_param_1 = tint_symbol.x_2_param_1;
+ x_1[0] = x_1_param;
+ x_1[1] = x_1_param_1;
+ x_2.field0 = x_2_param;
+ x_2.field1 = x_2_param_1;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.msl
new file mode 100644
index 0000000..ce7d66d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float field0;
+ float field1;
+};
+struct tint_array_wrapper {
+ float arr[2];
+};
+struct tint_symbol_2 {
+ float x_1_param [[user(locn1)]] [[flat]];
+ float x_1_param_1 [[user(locn2)]] [[flat]];
+ float x_2_param [[user(locn5)]] [[flat]];
+ float x_2_param_1 [[user(locn6)]] [[flat]];
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ thread tint_array_wrapper tint_symbol_3 = {};
+ thread S tint_symbol_4 = {};
+ float const x_1_param = tint_symbol_1.x_1_param;
+ float const x_1_param_1 = tint_symbol_1.x_1_param_1;
+ float const x_2_param = tint_symbol_1.x_2_param;
+ float const x_2_param_1 = tint_symbol_1.x_2_param_1;
+ tint_symbol_3.arr[0] = x_1_param;
+ tint_symbol_3.arr[1] = x_1_param_1;
+ tint_symbol_4.field0 = x_2_param;
+ tint_symbol_4.field1 = x_2_param_1;
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.spvasm
new file mode 100644
index 0000000..8b480f5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_2 %tint_symbol_3
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_float_uint_2 ArrayStride 4
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpDecorate %tint_symbol Location 1
+ OpDecorate %tint_symbol Flat
+ OpDecorate %tint_symbol_1 Location 2
+ OpDecorate %tint_symbol_1 Flat
+ OpDecorate %tint_symbol_2 Location 5
+ OpDecorate %tint_symbol_2 Flat
+ OpDecorate %tint_symbol_3 Location 6
+ OpDecorate %tint_symbol_3 Flat
+ %float = OpTypeFloat 32
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_arr_float_uint_2 = OpTypeArray %float %uint_2
+%_ptr_Private__arr_float_uint_2 = OpTypePointer Private %_arr_float_uint_2
+ %7 = OpConstantNull %_arr_float_uint_2
+ %x_1 = OpVariable %_ptr_Private__arr_float_uint_2 Private %7
+ %S = OpTypeStruct %float %float
+%_ptr_Private_S = OpTypePointer Private %S
+ %11 = OpConstantNull %S
+ %x_2 = OpVariable %_ptr_Private_S Private %11
+%_ptr_Input_float = OpTypePointer Input %float
+%tint_symbol = OpVariable %_ptr_Input_float Input
+%tint_symbol_1 = OpVariable %_ptr_Input_float Input
+%tint_symbol_2 = OpVariable %_ptr_Input_float Input
+%tint_symbol_3 = OpVariable %_ptr_Input_float Input
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_float = OpTypePointer Private %float
+ %int_1 = OpConstant %int 1
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %22 = OpLabel
+ %26 = OpAccessChain %_ptr_Private_float %x_1 %int_0
+ %27 = OpLoad %float %tint_symbol
+ OpStore %26 %27
+ %29 = OpAccessChain %_ptr_Private_float %x_1 %int_1
+ %30 = OpLoad %float %tint_symbol_1
+ OpStore %29 %30
+ %32 = OpAccessChain %_ptr_Private_float %x_2 %uint_0
+ %33 = OpLoad %float %tint_symbol_2
+ OpStore %32 %33
+ %35 = OpAccessChain %_ptr_Private_float %x_2 %uint_1
+ %36 = OpLoad %float %tint_symbol_3
+ OpStore %35 %36
+ %37 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.wgsl
new file mode 100644
index 0000000..490af9f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+struct S {
+ field0 : f32;
+ field1 : f32;
+};
+
+var<private> x_1 : array<f32, 2>;
+
+var<private> x_2 : S;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[location(1), interpolate(flat)]] x_1_param : f32, [[location(2), interpolate(flat)]] x_1_param_1 : f32, [[location(5), interpolate(flat)]] x_2_param : f32, [[location(6), interpolate(flat)]] x_2_param_1 : f32) {
+ x_1[0] = x_1_param;
+ x_1[1] = x_1_param_1;
+ x_2.field0 = x_2_param;
+ x_2.field1 = x_2_param_1;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm
new file mode 100644
index 0000000..cc6fcfd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 31
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main" %1
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %1 Location 1
+OpMemberDecorate %_struct_10 1 Centroid
+OpMemberDecorate %_struct_10 2 Sample
+OpMemberDecorate %_struct_10 3 NoPerspective
+OpMemberDecorate %_struct_10 4 NoPerspective
+OpMemberDecorate %_struct_10 4 Centroid
+OpMemberDecorate %_struct_10 5 NoPerspective
+OpMemberDecorate %_struct_10 5 Sample
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_10 = OpTypeStruct %float %float %float %float %float %float
+%_ptr_Input__struct_10 = OpTypePointer Input %_struct_10
+%1 = OpVariable %_ptr_Input__struct_10 Input
+%2 = OpFunction %void None %4
+%30 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.hlsl
new file mode 100644
index 0000000..acb71cc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.hlsl
@@ -0,0 +1,40 @@
+struct S {
+ float field0;
+ float field1;
+ float field2;
+ float field3;
+ float field4;
+ float field5;
+};
+
+static S x_1 = (S)0;
+
+void main_1() {
+ return;
+}
+
+struct tint_symbol_1 {
+ float x_1_param : TEXCOORD1;
+ linear centroid float x_1_param_1 : TEXCOORD2;
+ linear sample float x_1_param_2 : TEXCOORD3;
+ noperspective float x_1_param_3 : TEXCOORD4;
+ noperspective centroid float x_1_param_4 : TEXCOORD5;
+ noperspective sample float x_1_param_5 : TEXCOORD6;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const float x_1_param = tint_symbol.x_1_param;
+ const float x_1_param_1 = tint_symbol.x_1_param_1;
+ const float x_1_param_2 = tint_symbol.x_1_param_2;
+ const float x_1_param_3 = tint_symbol.x_1_param_3;
+ const float x_1_param_4 = tint_symbol.x_1_param_4;
+ const float x_1_param_5 = tint_symbol.x_1_param_5;
+ x_1.field0 = x_1_param;
+ x_1.field1 = x_1_param_1;
+ x_1.field2 = x_1_param_2;
+ x_1.field3 = x_1_param_3;
+ x_1.field4 = x_1_param_4;
+ x_1.field5 = x_1_param_5;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.msl
new file mode 100644
index 0000000..be0799e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.msl
@@ -0,0 +1,42 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float field0;
+ float field1;
+ float field2;
+ float field3;
+ float field4;
+ float field5;
+};
+struct tint_symbol_2 {
+ float x_1_param [[user(locn1)]];
+ float x_1_param_1 [[user(locn2)]] [[centroid_perspective]];
+ float x_1_param_2 [[user(locn3)]] [[sample_perspective]];
+ float x_1_param_3 [[user(locn4)]] [[no_perspective]];
+ float x_1_param_4 [[user(locn5)]] [[centroid_no_perspective]];
+ float x_1_param_5 [[user(locn6)]] [[sample_no_perspective]];
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ thread S tint_symbol_3 = {};
+ float const x_1_param = tint_symbol_1.x_1_param;
+ float const x_1_param_1 = tint_symbol_1.x_1_param_1;
+ float const x_1_param_2 = tint_symbol_1.x_1_param_2;
+ float const x_1_param_3 = tint_symbol_1.x_1_param_3;
+ float const x_1_param_4 = tint_symbol_1.x_1_param_4;
+ float const x_1_param_5 = tint_symbol_1.x_1_param_5;
+ tint_symbol_3.field0 = x_1_param;
+ tint_symbol_3.field1 = x_1_param_1;
+ tint_symbol_3.field2 = x_1_param_2;
+ tint_symbol_3.field3 = x_1_param_3;
+ tint_symbol_3.field4 = x_1_param_4;
+ tint_symbol_3.field5 = x_1_param_5;
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.spvasm
new file mode 100644
index 0000000..9a23387
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.spvasm
@@ -0,0 +1,94 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampleRateShading
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_2 %tint_symbol_3 %tint_symbol_4 %tint_symbol_5
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpMemberName %S 3 "field3"
+ OpMemberName %S 4 "field4"
+ OpMemberName %S 5 "field5"
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %tint_symbol_5 "tint_symbol_5"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 2 Offset 8
+ OpMemberDecorate %S 3 Offset 12
+ OpMemberDecorate %S 4 Offset 16
+ OpMemberDecorate %S 5 Offset 20
+ OpDecorate %tint_symbol Location 1
+ OpDecorate %tint_symbol_1 Location 2
+ OpDecorate %tint_symbol_1 Centroid
+ OpDecorate %tint_symbol_2 Location 3
+ OpDecorate %tint_symbol_2 Sample
+ OpDecorate %tint_symbol_3 Location 4
+ OpDecorate %tint_symbol_3 NoPerspective
+ OpDecorate %tint_symbol_4 Location 5
+ OpDecorate %tint_symbol_4 NoPerspective
+ OpDecorate %tint_symbol_4 Centroid
+ OpDecorate %tint_symbol_5 Location 6
+ OpDecorate %tint_symbol_5 NoPerspective
+ OpDecorate %tint_symbol_5 Sample
+ %float = OpTypeFloat 32
+ %S = OpTypeStruct %float %float %float %float %float %float
+%_ptr_Private_S = OpTypePointer Private %S
+ %5 = OpConstantNull %S
+ %x_1 = OpVariable %_ptr_Private_S Private %5
+%_ptr_Input_float = OpTypePointer Input %float
+%tint_symbol = OpVariable %_ptr_Input_float Input
+%tint_symbol_1 = OpVariable %_ptr_Input_float Input
+%tint_symbol_2 = OpVariable %_ptr_Input_float Input
+%tint_symbol_3 = OpVariable %_ptr_Input_float Input
+%tint_symbol_4 = OpVariable %_ptr_Input_float Input
+%tint_symbol_5 = OpVariable %_ptr_Input_float Input
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_Private_float = OpTypePointer Private %float
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %13
+ %16 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %13
+ %18 = OpLabel
+ %22 = OpAccessChain %_ptr_Private_float %x_1 %uint_0
+ %23 = OpLoad %float %tint_symbol
+ OpStore %22 %23
+ %25 = OpAccessChain %_ptr_Private_float %x_1 %uint_1
+ %26 = OpLoad %float %tint_symbol_1
+ OpStore %25 %26
+ %28 = OpAccessChain %_ptr_Private_float %x_1 %uint_2
+ %29 = OpLoad %float %tint_symbol_2
+ OpStore %28 %29
+ %31 = OpAccessChain %_ptr_Private_float %x_1 %uint_3
+ %32 = OpLoad %float %tint_symbol_3
+ OpStore %31 %32
+ %34 = OpAccessChain %_ptr_Private_float %x_1 %uint_4
+ %35 = OpLoad %float %tint_symbol_4
+ OpStore %34 %35
+ %37 = OpAccessChain %_ptr_Private_float %x_1 %uint_5
+ %38 = OpLoad %float %tint_symbol_5
+ OpStore %37 %38
+ %39 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.wgsl
new file mode 100644
index 0000000..6f69d2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+struct S {
+ field0 : f32;
+ field1 : f32;
+ field2 : f32;
+ field3 : f32;
+ field4 : f32;
+ field5 : f32;
+};
+
+var<private> x_1 : S;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[location(1)]] x_1_param : f32, [[location(2), interpolate(perspective, centroid)]] x_1_param_1 : f32, [[location(3), interpolate(perspective, sample)]] x_1_param_2 : f32, [[location(4), interpolate(linear)]] x_1_param_3 : f32, [[location(5), interpolate(linear, centroid)]] x_1_param_4 : f32, [[location(6), interpolate(linear, sample)]] x_1_param_5 : f32) {
+ x_1.field0 = x_1_param;
+ x_1.field1 = x_1_param_1;
+ x_1.field2 = x_1_param_2;
+ x_1.field3 = x_1_param_3;
+ x_1.field4 = x_1_param_4;
+ x_1.field5 = x_1_param_5;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm
new file mode 100644
index 0000000..cddeeec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 31
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main" %1
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %1 Location 1
+OpMemberDecorate %_struct_10 1 Centroid
+OpMemberDecorate %_struct_10 2 Sample
+OpMemberDecorate %_struct_10 3 NoPerspective
+OpMemberDecorate %_struct_10 4 NoPerspective
+OpMemberDecorate %_struct_10 4 Centroid
+OpMemberDecorate %_struct_10 5 NoPerspective
+OpMemberDecorate %_struct_10 5 Sample
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_10 = OpTypeStruct %float %float %float %float %float %float
+%_ptr_Output__struct_10 = OpTypePointer Output %_struct_10
+%1 = OpVariable %_ptr_Output__struct_10 Output
+%2 = OpFunction %void None %4
+%30 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.hlsl
new file mode 100644
index 0000000..dfc897a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.hlsl
@@ -0,0 +1,38 @@
+struct S {
+ float field0;
+ float field1;
+ float field2;
+ float field3;
+ float field4;
+ float field5;
+};
+
+static S x_1 = (S)0;
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float x_1_1;
+ float x_1_2;
+ float x_1_3;
+ float x_1_4;
+ float x_1_5;
+ float x_1_6;
+};
+struct tint_symbol {
+ float x_1_1 : SV_Target1;
+ linear centroid float x_1_2 : SV_Target2;
+ linear sample float x_1_3 : SV_Target3;
+ noperspective float x_1_4 : SV_Target4;
+ noperspective centroid float x_1_5 : SV_Target5;
+ noperspective sample float x_1_6 : SV_Target6;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_1.field0, x_1.field1, x_1.field2, x_1.field3, x_1.field4, x_1.field5};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1, tint_symbol_1.x_1_2, tint_symbol_1.x_1_3, tint_symbol_1.x_1_4, tint_symbol_1.x_1_5, tint_symbol_1.x_1_6};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.msl
new file mode 100644
index 0000000..6f664e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.msl
@@ -0,0 +1,40 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float field0;
+ float field1;
+ float field2;
+ float field3;
+ float field4;
+ float field5;
+};
+struct main_out {
+ float x_1_1;
+ float x_1_2;
+ float x_1_3;
+ float x_1_4;
+ float x_1_5;
+ float x_1_6;
+};
+struct tint_symbol_1 {
+ float x_1_1 [[color(1)]];
+ float x_1_2 [[color(2)]] [[centroid_perspective]];
+ float x_1_3 [[color(3)]] [[sample_perspective]];
+ float x_1_4 [[color(4)]] [[no_perspective]];
+ float x_1_5 [[color(5)]] [[centroid_no_perspective]];
+ float x_1_6 [[color(6)]] [[sample_no_perspective]];
+};
+
+void main_1() {
+ return;
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ thread S tint_symbol_4 = {};
+ main_1();
+ main_out const tint_symbol_2 = {.x_1_1=tint_symbol_4.field0, .x_1_2=tint_symbol_4.field1, .x_1_3=tint_symbol_4.field2, .x_1_4=tint_symbol_4.field3, .x_1_5=tint_symbol_4.field4, .x_1_6=tint_symbol_4.field5};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1, .x_1_2=tint_symbol_2.x_1_2, .x_1_3=tint_symbol_2.x_1_3, .x_1_4=tint_symbol_2.x_1_4, .x_1_5=tint_symbol_2.x_1_5, .x_1_6=tint_symbol_2.x_1_6};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.spvasm
new file mode 100644
index 0000000..d6f3990
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.spvasm
@@ -0,0 +1,125 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampleRateShading
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 %tint_symbol_3 %tint_symbol_4 %tint_symbol_5 %tint_symbol_6
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpMemberName %S 3 "field3"
+ OpMemberName %S 4 "field4"
+ OpMemberName %S 5 "field5"
+ OpName %x_1 "x_1"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %tint_symbol_5 "tint_symbol_5"
+ OpName %tint_symbol_6 "tint_symbol_6"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpMemberName %main_out 1 "x_1_2"
+ OpMemberName %main_out 2 "x_1_3"
+ OpMemberName %main_out 3 "x_1_4"
+ OpMemberName %main_out 4 "x_1_5"
+ OpMemberName %main_out 5 "x_1_6"
+ OpName %tint_symbol_7 "tint_symbol_7"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 2 Offset 8
+ OpMemberDecorate %S 3 Offset 12
+ OpMemberDecorate %S 4 Offset 16
+ OpMemberDecorate %S 5 Offset 20
+ OpDecorate %tint_symbol_1 Location 1
+ OpDecorate %tint_symbol_2 Location 2
+ OpDecorate %tint_symbol_2 Centroid
+ OpDecorate %tint_symbol_3 Location 3
+ OpDecorate %tint_symbol_3 Sample
+ OpDecorate %tint_symbol_4 Location 4
+ OpDecorate %tint_symbol_4 NoPerspective
+ OpDecorate %tint_symbol_5 Location 5
+ OpDecorate %tint_symbol_5 NoPerspective
+ OpDecorate %tint_symbol_5 Centroid
+ OpDecorate %tint_symbol_6 Location 6
+ OpDecorate %tint_symbol_6 NoPerspective
+ OpDecorate %tint_symbol_6 Sample
+ OpMemberDecorate %main_out 0 Offset 0
+ OpMemberDecorate %main_out 1 Offset 4
+ OpMemberDecorate %main_out 2 Offset 8
+ OpMemberDecorate %main_out 3 Offset 12
+ OpMemberDecorate %main_out 4 Offset 16
+ OpMemberDecorate %main_out 5 Offset 20
+ %float = OpTypeFloat 32
+ %S = OpTypeStruct %float %float %float %float %float %float
+%_ptr_Private_S = OpTypePointer Private %S
+ %5 = OpConstantNull %S
+ %x_1 = OpVariable %_ptr_Private_S Private %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%tint_symbol_1 = OpVariable %_ptr_Output_float Output %8
+%tint_symbol_2 = OpVariable %_ptr_Output_float Output %8
+%tint_symbol_3 = OpVariable %_ptr_Output_float Output %8
+%tint_symbol_4 = OpVariable %_ptr_Output_float Output %8
+%tint_symbol_5 = OpVariable %_ptr_Output_float Output %8
+%tint_symbol_6 = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %14 = OpTypeFunction %void
+ %main_out = OpTypeStruct %float %float %float %float %float %float
+ %18 = OpTypeFunction %void %main_out
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_Private_float = OpTypePointer Private %float
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %14
+ %17 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_7 = OpFunction %void None %18
+%tint_symbol = OpFunctionParameter %main_out
+ %22 = OpLabel
+ %23 = OpCompositeExtract %float %tint_symbol 0
+ OpStore %tint_symbol_1 %23
+ %24 = OpCompositeExtract %float %tint_symbol 1
+ OpStore %tint_symbol_2 %24
+ %25 = OpCompositeExtract %float %tint_symbol 2
+ OpStore %tint_symbol_3 %25
+ %26 = OpCompositeExtract %float %tint_symbol 3
+ OpStore %tint_symbol_4 %26
+ %27 = OpCompositeExtract %float %tint_symbol 4
+ OpStore %tint_symbol_5 %27
+ %28 = OpCompositeExtract %float %tint_symbol 5
+ OpStore %tint_symbol_6 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %14
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %main_1
+ %36 = OpAccessChain %_ptr_Private_float %x_1 %uint_0
+ %37 = OpLoad %float %36
+ %39 = OpAccessChain %_ptr_Private_float %x_1 %uint_1
+ %40 = OpLoad %float %39
+ %42 = OpAccessChain %_ptr_Private_float %x_1 %uint_2
+ %43 = OpLoad %float %42
+ %45 = OpAccessChain %_ptr_Private_float %x_1 %uint_3
+ %46 = OpLoad %float %45
+ %48 = OpAccessChain %_ptr_Private_float %x_1 %uint_4
+ %49 = OpLoad %float %48
+ %51 = OpAccessChain %_ptr_Private_float %x_1 %uint_5
+ %52 = OpLoad %float %51
+ %53 = OpCompositeConstruct %main_out %37 %40 %43 %46 %49 %52
+ %32 = OpFunctionCall %void %tint_symbol_7 %53
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.wgsl
new file mode 100644
index 0000000..985d7db
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.wgsl
@@ -0,0 +1,35 @@
+struct S {
+ field0 : f32;
+ field1 : f32;
+ field2 : f32;
+ field3 : f32;
+ field4 : f32;
+ field5 : f32;
+};
+
+var<private> x_1 : S;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[location(1)]]
+ x_1_1 : f32;
+ [[location(2), interpolate(perspective, centroid)]]
+ x_1_2 : f32;
+ [[location(3), interpolate(perspective, sample)]]
+ x_1_3 : f32;
+ [[location(4), interpolate(linear)]]
+ x_1_4 : f32;
+ [[location(5), interpolate(linear, centroid)]]
+ x_1_5 : f32;
+ [[location(6), interpolate(linear, sample)]]
+ x_1_6 : f32;
+};
+
+[[stage(fragment)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_1.field0, x_1.field1, x_1.field2, x_1.field3, x_1.field4, x_1.field5);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm
new file mode 100644
index 0000000..55e55ee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 34
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %5 "main" %1 %2 %3 %4
+OpExecutionMode %5 OriginUpperLeft
+OpDecorate %1 Location 0
+OpDecorate %2 Location 0
+OpDecorate %3 Location 30
+OpDecorate %4 Location 40
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_uint = OpTypePointer Output %uint
+%1 = OpVariable %_ptr_Input_uint Input
+%2 = OpVariable %_ptr_Output_uint Output
+%3 = OpVariable %_ptr_Input_uint Input
+%4 = OpVariable %_ptr_Output_uint Output
+%5 = OpFunction %void None %7
+%33 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.hlsl
new file mode 100644
index 0000000..9442b68
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+static uint x_1 = 0u;
+static uint x_2 = 0u;
+static uint x_3 = 0u;
+static uint x_4 = 0u;
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ uint x_2_1;
+ uint x_4_1;
+};
+struct tint_symbol_1 {
+ uint x_1_param : TEXCOORD0;
+ uint x_3_param : TEXCOORD30;
+};
+struct tint_symbol_2 {
+ uint x_2_1 : SV_Target0;
+ uint x_4_1 : SV_Target40;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ const uint x_3_param = tint_symbol.x_3_param;
+ x_1 = x_1_param;
+ x_3 = x_3_param;
+ main_1();
+ const main_out tint_symbol_3 = {x_2, x_4};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_2_1, tint_symbol_3.x_4_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.msl
new file mode 100644
index 0000000..79eaec2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ uint x_2_1;
+ uint x_4_1;
+};
+struct tint_symbol_2 {
+ uint x_1_param [[user(locn0)]];
+ uint x_3_param [[user(locn30)]];
+};
+struct tint_symbol_3 {
+ uint x_2_1 [[color(0)]];
+ uint x_4_1 [[color(40)]];
+};
+
+void main_1() {
+ return;
+}
+
+fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ thread uint tint_symbol_6 = 0u;
+ thread uint tint_symbol_7 = 0u;
+ thread uint tint_symbol_8 = 0u;
+ thread uint tint_symbol_9 = 0u;
+ uint const x_1_param = tint_symbol_1.x_1_param;
+ uint const x_3_param = tint_symbol_1.x_3_param;
+ tint_symbol_6 = x_1_param;
+ tint_symbol_7 = x_3_param;
+ main_1();
+ main_out const tint_symbol_4 = {.x_2_1=tint_symbol_8, .x_4_1=tint_symbol_9};
+ tint_symbol_3 const tint_symbol_5 = {.x_2_1=tint_symbol_4.x_2_1, .x_4_1=tint_symbol_4.x_4_1};
+ return tint_symbol_5;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.spvasm
new file mode 100644
index 0000000..07d96dd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_3 %tint_symbol_4
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %x_3 "x_3"
+ OpName %x_4 "x_4"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_2_1"
+ OpMemberName %main_out 1 "x_4_1"
+ OpName %tint_symbol_5 "tint_symbol_5"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main "main"
+ OpDecorate %tint_symbol Location 0
+ OpDecorate %tint_symbol Flat
+ OpDecorate %tint_symbol_1 Location 30
+ OpDecorate %tint_symbol_1 Flat
+ OpDecorate %tint_symbol_3 Location 0
+ OpDecorate %tint_symbol_4 Location 40
+ OpMemberDecorate %main_out 0 Offset 0
+ OpMemberDecorate %main_out 1 Offset 4
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+ %x_2 = OpVariable %_ptr_Private_uint Private %4
+ %x_3 = OpVariable %_ptr_Private_uint Private %4
+ %x_4 = OpVariable %_ptr_Private_uint Private %4
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%tint_symbol_1 = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_uint = OpTypePointer Output %uint
+%tint_symbol_3 = OpVariable %_ptr_Output_uint Output %4
+%tint_symbol_4 = OpVariable %_ptr_Output_uint Output %4
+ %void = OpTypeVoid
+ %14 = OpTypeFunction %void
+ %main_out = OpTypeStruct %uint %uint
+ %18 = OpTypeFunction %void %main_out
+ %main_1 = OpFunction %void None %14
+ %17 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_5 = OpFunction %void None %18
+%tint_symbol_2 = OpFunctionParameter %main_out
+ %22 = OpLabel
+ %23 = OpCompositeExtract %uint %tint_symbol_2 0
+ OpStore %tint_symbol_3 %23
+ %24 = OpCompositeExtract %uint %tint_symbol_2 1
+ OpStore %tint_symbol_4 %24
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %14
+ %26 = OpLabel
+ %27 = OpLoad %uint %tint_symbol
+ OpStore %x_1 %27
+ %28 = OpLoad %uint %tint_symbol_1
+ OpStore %x_3 %28
+ %29 = OpFunctionCall %void %main_1
+ %31 = OpLoad %uint %x_2
+ %32 = OpLoad %uint %x_4
+ %33 = OpCompositeConstruct %main_out %31 %32
+ %30 = OpFunctionCall %void %tint_symbol_5 %33
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.wgsl
new file mode 100644
index 0000000..542ae52
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.wgsl
@@ -0,0 +1,26 @@
+var<private> x_1 : u32;
+
+var<private> x_2 : u32;
+
+var<private> x_3 : u32;
+
+var<private> x_4 : u32;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[location(0)]]
+ x_2_1 : u32;
+ [[location(40)]]
+ x_4_1 : u32;
+};
+
+[[stage(fragment)]]
+fn main([[location(0)]] x_1_param : u32, [[location(30)]] x_3_param : u32) -> main_out {
+ x_1 = x_1_param;
+ x_3 = x_3_param;
+ main_1();
+ return main_out(x_2, x_4);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm
new file mode 100644
index 0000000..5e28c67
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 42
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %7 "main" %1 %2 %3 %4 %5 %6 %gl_Position
+OpDecorate %1 Location 1
+OpDecorate %2 Location 2
+OpDecorate %3 Location 3
+OpDecorate %4 Location 4
+OpDecorate %5 Location 5
+OpDecorate %6 Location 6
+OpDecorate %1 Flat
+OpDecorate %2 Flat
+OpDecorate %3 Flat
+OpDecorate %4 Flat
+OpDecorate %5 Flat
+OpDecorate %6 Flat
+OpDecorate %gl_Position BuiltIn Position
+%void = OpTypeVoid
+%9 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Input_v2uint = OpTypePointer Input %v2uint
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_v2int = OpTypePointer Input %v2int
+%_ptr_Input_float = OpTypePointer Input %float
+%_ptr_Input_v2float = OpTypePointer Input %v2float
+%1 = OpVariable %_ptr_Input_uint Input
+%2 = OpVariable %_ptr_Input_v2uint Input
+%3 = OpVariable %_ptr_Input_int Input
+%4 = OpVariable %_ptr_Input_v2int Input
+%5 = OpVariable %_ptr_Input_float Input
+%6 = OpVariable %_ptr_Input_v2float Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%7 = OpFunction %void None %9
+%41 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.hlsl
new file mode 100644
index 0000000..663d6d0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.hlsl
@@ -0,0 +1,45 @@
+static uint x_1 = 0u;
+static uint2 x_2 = uint2(0u, 0u);
+static int x_3 = 0;
+static int2 x_4 = int2(0, 0);
+static float x_5 = 0.0f;
+static float2 x_6 = float2(0.0f, 0.0f);
+static float4 x_8 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 x_8_1;
+};
+struct tint_symbol_1 {
+ uint x_1_param : TEXCOORD1;
+ uint2 x_2_param : TEXCOORD2;
+ int x_3_param : TEXCOORD3;
+ int2 x_4_param : TEXCOORD4;
+ nointerpolation float x_5_param : TEXCOORD5;
+ nointerpolation float2 x_6_param : TEXCOORD6;
+};
+struct tint_symbol_2 {
+ float4 x_8_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ const uint2 x_2_param = tint_symbol.x_2_param;
+ const int x_3_param = tint_symbol.x_3_param;
+ const int2 x_4_param = tint_symbol.x_4_param;
+ const float x_5_param = tint_symbol.x_5_param;
+ const float2 x_6_param = tint_symbol.x_6_param;
+ x_1 = x_1_param;
+ x_2 = x_2_param;
+ x_3 = x_3_param;
+ x_4 = x_4_param;
+ x_5 = x_5_param;
+ x_6 = x_6_param;
+ main_1();
+ const main_out tint_symbol_3 = {x_8};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_8_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.msl
new file mode 100644
index 0000000..8ddfb07
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.msl
@@ -0,0 +1,48 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_8_1;
+};
+struct tint_symbol_2 {
+ uint x_1_param [[attribute(1)]];
+ uint2 x_2_param [[attribute(2)]];
+ int x_3_param [[attribute(3)]];
+ int2 x_4_param [[attribute(4)]];
+ float x_5_param [[attribute(5)]] [[flat]];
+ float2 x_6_param [[attribute(6)]] [[flat]];
+};
+struct tint_symbol_3 {
+ float4 x_8_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ thread uint tint_symbol_6 = 0u;
+ thread uint2 tint_symbol_7 = 0u;
+ thread int tint_symbol_8 = 0;
+ thread int2 tint_symbol_9 = 0;
+ thread float tint_symbol_10 = 0.0f;
+ thread float2 tint_symbol_11 = 0.0f;
+ thread float4 tint_symbol_12 = 0.0f;
+ uint const x_1_param = tint_symbol_1.x_1_param;
+ uint2 const x_2_param = tint_symbol_1.x_2_param;
+ int const x_3_param = tint_symbol_1.x_3_param;
+ int2 const x_4_param = tint_symbol_1.x_4_param;
+ float const x_5_param = tint_symbol_1.x_5_param;
+ float2 const x_6_param = tint_symbol_1.x_6_param;
+ tint_symbol_6 = x_1_param;
+ tint_symbol_7 = x_2_param;
+ tint_symbol_8 = x_3_param;
+ tint_symbol_9 = x_4_param;
+ tint_symbol_10 = x_5_param;
+ tint_symbol_11 = x_6_param;
+ main_1();
+ main_out const tint_symbol_4 = {.x_8_1=tint_symbol_12};
+ tint_symbol_3 const tint_symbol_5 = {.x_8_1=tint_symbol_4.x_8_1};
+ return tint_symbol_5;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.spvasm
new file mode 100644
index 0000000..9ee3142
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.spvasm
@@ -0,0 +1,121 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 68
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_1 %tint_symbol_2 %tint_symbol_3 %tint_symbol_4 %tint_symbol_5 %tint_symbol_7
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %x_3 "x_3"
+ OpName %x_4 "x_4"
+ OpName %x_5 "x_5"
+ OpName %x_6 "x_6"
+ OpName %x_8 "x_8"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %tint_symbol_5 "tint_symbol_5"
+ OpName %tint_symbol_7 "tint_symbol_7"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_8_1"
+ OpName %tint_symbol_8 "tint_symbol_8"
+ OpName %tint_symbol_6 "tint_symbol_6"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol Location 1
+ OpDecorate %tint_symbol_1 Location 2
+ OpDecorate %tint_symbol_2 Location 3
+ OpDecorate %tint_symbol_3 Location 4
+ OpDecorate %tint_symbol_4 Location 5
+ OpDecorate %tint_symbol_4 Flat
+ OpDecorate %tint_symbol_5 Location 6
+ OpDecorate %tint_symbol_5 Flat
+ OpDecorate %tint_symbol_7 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %8 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %8
+ %v2uint = OpTypeVector %uint 2
+%_ptr_Private_v2uint = OpTypePointer Private %v2uint
+ %12 = OpConstantNull %v2uint
+ %x_2 = OpVariable %_ptr_Private_v2uint Private %12
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %16 = OpConstantNull %int
+ %x_3 = OpVariable %_ptr_Private_int Private %16
+ %v2int = OpTypeVector %int 2
+%_ptr_Private_v2int = OpTypePointer Private %v2int
+ %20 = OpConstantNull %v2int
+ %x_4 = OpVariable %_ptr_Private_v2int Private %20
+%_ptr_Private_float = OpTypePointer Private %float
+ %x_5 = OpVariable %_ptr_Private_float Private %4
+ %v2float = OpTypeVector %float 2
+%_ptr_Private_v2float = OpTypePointer Private %v2float
+ %26 = OpConstantNull %v2float
+ %x_6 = OpVariable %_ptr_Private_v2float Private %26
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %30 = OpConstantNull %v4float
+ %x_8 = OpVariable %_ptr_Private_v4float Private %30
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Input_v2uint = OpTypePointer Input %v2uint
+%tint_symbol_1 = OpVariable %_ptr_Input_v2uint Input
+%_ptr_Input_int = OpTypePointer Input %int
+%tint_symbol_2 = OpVariable %_ptr_Input_int Input
+%_ptr_Input_v2int = OpTypePointer Input %v2int
+%tint_symbol_3 = OpVariable %_ptr_Input_v2int Input
+%_ptr_Input_float = OpTypePointer Input %float
+%tint_symbol_4 = OpVariable %_ptr_Input_float Input
+%_ptr_Input_v2float = OpTypePointer Input %v2float
+%tint_symbol_5 = OpVariable %_ptr_Input_v2float Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_7 = OpVariable %_ptr_Output_v4float Output %30
+ %void = OpTypeVoid
+ %45 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %49 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %45
+ %48 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_8 = OpFunction %void None %49
+%tint_symbol_6 = OpFunctionParameter %main_out
+ %53 = OpLabel
+ %54 = OpCompositeExtract %v4float %tint_symbol_6 0
+ OpStore %tint_symbol_7 %54
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %45
+ %56 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %58 = OpLoad %uint %tint_symbol
+ OpStore %x_1 %58
+ %59 = OpLoad %v2uint %tint_symbol_1
+ OpStore %x_2 %59
+ %60 = OpLoad %int %tint_symbol_2
+ OpStore %x_3 %60
+ %61 = OpLoad %v2int %tint_symbol_3
+ OpStore %x_4 %61
+ %62 = OpLoad %float %tint_symbol_4
+ OpStore %x_5 %62
+ %63 = OpLoad %v2float %tint_symbol_5
+ OpStore %x_6 %63
+ %64 = OpFunctionCall %void %main_1
+ %66 = OpLoad %v4float %x_8
+ %67 = OpCompositeConstruct %main_out %66
+ %65 = OpFunctionCall %void %tint_symbol_8 %67
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.wgsl
new file mode 100644
index 0000000..7122217
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.wgsl
@@ -0,0 +1,34 @@
+var<private> x_1 : u32;
+
+var<private> x_2 : vec2<u32>;
+
+var<private> x_3 : i32;
+
+var<private> x_4 : vec2<i32>;
+
+var<private> x_5 : f32;
+
+var<private> x_6 : vec2<f32>;
+
+var<private> x_8 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_8_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[location(1)]] x_1_param : u32, [[location(2)]] x_2_param : vec2<u32>, [[location(3)]] x_3_param : i32, [[location(4)]] x_4_param : vec2<i32>, [[location(5), interpolate(flat)]] x_5_param : f32, [[location(6), interpolate(flat)]] x_6_param : vec2<f32>) -> main_out {
+ x_1 = x_1_param;
+ x_2 = x_2_param;
+ x_3 = x_3_param;
+ x_4 = x_4_param;
+ x_5 = x_5_param;
+ x_6 = x_6_param;
+ main_1();
+ return main_out(x_8);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm
new file mode 100644
index 0000000..5cecd41
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 42
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %7 "main" %1 %2 %3 %4 %5 %6 %gl_Position
+OpDecorate %1 Location 1
+OpDecorate %2 Location 2
+OpDecorate %3 Location 3
+OpDecorate %4 Location 4
+OpDecorate %5 Location 5
+OpDecorate %6 Location 6
+OpDecorate %1 Flat
+OpDecorate %2 Flat
+OpDecorate %3 Flat
+OpDecorate %4 Flat
+OpDecorate %5 Flat
+OpDecorate %6 Flat
+OpDecorate %gl_Position BuiltIn Position
+%void = OpTypeVoid
+%9 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Output_v2uint = OpTypePointer Output %v2uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_v2int = OpTypePointer Output %v2int
+%_ptr_Output_float = OpTypePointer Output %float
+%_ptr_Output_v2float = OpTypePointer Output %v2float
+%1 = OpVariable %_ptr_Output_uint Output
+%2 = OpVariable %_ptr_Output_v2uint Output
+%3 = OpVariable %_ptr_Output_int Output
+%4 = OpVariable %_ptr_Output_v2int Output
+%5 = OpVariable %_ptr_Output_float Output
+%6 = OpVariable %_ptr_Output_v2float Output
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%7 = OpFunction %void None %9
+%41 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.hlsl
new file mode 100644
index 0000000..453432d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.hlsl
@@ -0,0 +1,37 @@
+static uint x_1 = 0u;
+static uint2 x_2 = uint2(0u, 0u);
+static int x_3 = 0;
+static int2 x_4 = int2(0, 0);
+static float x_5 = 0.0f;
+static float2 x_6 = float2(0.0f, 0.0f);
+static float4 x_8 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ uint x_1_1;
+ uint2 x_2_1;
+ int x_3_1;
+ int2 x_4_1;
+ float x_5_1;
+ float2 x_6_1;
+ float4 x_8_1;
+};
+struct tint_symbol {
+ uint x_1_1 : TEXCOORD1;
+ uint2 x_2_1 : TEXCOORD2;
+ int x_3_1 : TEXCOORD3;
+ int2 x_4_1 : TEXCOORD4;
+ nointerpolation float x_5_1 : TEXCOORD5;
+ nointerpolation float2 x_6_1 : TEXCOORD6;
+ float4 x_8_1 : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_1, x_2, x_3, x_4, x_5, x_6, x_8};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1, tint_symbol_1.x_2_1, tint_symbol_1.x_3_1, tint_symbol_1.x_4_1, tint_symbol_1.x_5_1, tint_symbol_1.x_6_1, tint_symbol_1.x_8_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.msl
new file mode 100644
index 0000000..05b18ed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.msl
@@ -0,0 +1,40 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ uint x_1_1;
+ uint2 x_2_1;
+ int x_3_1;
+ int2 x_4_1;
+ float x_5_1;
+ float2 x_6_1;
+ float4 x_8_1;
+};
+struct tint_symbol_1 {
+ uint x_1_1 [[user(locn1)]];
+ uint2 x_2_1 [[user(locn2)]];
+ int x_3_1 [[user(locn3)]];
+ int2 x_4_1 [[user(locn4)]];
+ float x_5_1 [[user(locn5)]] [[flat]];
+ float2 x_6_1 [[user(locn6)]] [[flat]];
+ float4 x_8_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread uint tint_symbol_4 = 0u;
+ thread uint2 tint_symbol_5 = 0u;
+ thread int tint_symbol_6 = 0;
+ thread int2 tint_symbol_7 = 0;
+ thread float tint_symbol_8 = 0.0f;
+ thread float2 tint_symbol_9 = 0.0f;
+ thread float4 tint_symbol_10 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.x_1_1=tint_symbol_4, .x_2_1=tint_symbol_5, .x_3_1=tint_symbol_6, .x_4_1=tint_symbol_7, .x_5_1=tint_symbol_8, .x_6_1=tint_symbol_9, .x_8_1=tint_symbol_10};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1, .x_2_1=tint_symbol_2.x_2_1, .x_3_1=tint_symbol_2.x_3_1, .x_4_1=tint_symbol_2.x_4_1, .x_5_1=tint_symbol_2.x_5_1, .x_6_1=tint_symbol_2.x_6_1, .x_8_1=tint_symbol_2.x_8_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.spvasm
new file mode 100644
index 0000000..52337ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.spvasm
@@ -0,0 +1,142 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 73
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1 %tint_symbol_2 %tint_symbol_3 %tint_symbol_4 %tint_symbol_5 %tint_symbol_6 %tint_symbol_7
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %x_3 "x_3"
+ OpName %x_4 "x_4"
+ OpName %x_5 "x_5"
+ OpName %x_6 "x_6"
+ OpName %x_8 "x_8"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %tint_symbol_5 "tint_symbol_5"
+ OpName %tint_symbol_6 "tint_symbol_6"
+ OpName %tint_symbol_7 "tint_symbol_7"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpMemberName %main_out 1 "x_2_1"
+ OpMemberName %main_out 2 "x_3_1"
+ OpMemberName %main_out 3 "x_4_1"
+ OpMemberName %main_out 4 "x_5_1"
+ OpMemberName %main_out 5 "x_6_1"
+ OpMemberName %main_out 6 "x_8_1"
+ OpName %tint_symbol_8 "tint_symbol_8"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 Location 1
+ OpDecorate %tint_symbol_1 Flat
+ OpDecorate %tint_symbol_2 Location 2
+ OpDecorate %tint_symbol_2 Flat
+ OpDecorate %tint_symbol_3 Location 3
+ OpDecorate %tint_symbol_3 Flat
+ OpDecorate %tint_symbol_4 Location 4
+ OpDecorate %tint_symbol_4 Flat
+ OpDecorate %tint_symbol_5 Location 5
+ OpDecorate %tint_symbol_5 Flat
+ OpDecorate %tint_symbol_6 Location 6
+ OpDecorate %tint_symbol_6 Flat
+ OpDecorate %tint_symbol_7 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ OpMemberDecorate %main_out 1 Offset 8
+ OpMemberDecorate %main_out 2 Offset 16
+ OpMemberDecorate %main_out 3 Offset 24
+ OpMemberDecorate %main_out 4 Offset 32
+ OpMemberDecorate %main_out 5 Offset 40
+ OpMemberDecorate %main_out 6 Offset 48
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %8 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %8
+ %v2uint = OpTypeVector %uint 2
+%_ptr_Private_v2uint = OpTypePointer Private %v2uint
+ %12 = OpConstantNull %v2uint
+ %x_2 = OpVariable %_ptr_Private_v2uint Private %12
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %16 = OpConstantNull %int
+ %x_3 = OpVariable %_ptr_Private_int Private %16
+ %v2int = OpTypeVector %int 2
+%_ptr_Private_v2int = OpTypePointer Private %v2int
+ %20 = OpConstantNull %v2int
+ %x_4 = OpVariable %_ptr_Private_v2int Private %20
+%_ptr_Private_float = OpTypePointer Private %float
+ %x_5 = OpVariable %_ptr_Private_float Private %4
+ %v2float = OpTypeVector %float 2
+%_ptr_Private_v2float = OpTypePointer Private %v2float
+ %26 = OpConstantNull %v2float
+ %x_6 = OpVariable %_ptr_Private_v2float Private %26
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %30 = OpConstantNull %v4float
+ %x_8 = OpVariable %_ptr_Private_v4float Private %30
+%_ptr_Output_uint = OpTypePointer Output %uint
+%tint_symbol_1 = OpVariable %_ptr_Output_uint Output %8
+%_ptr_Output_v2uint = OpTypePointer Output %v2uint
+%tint_symbol_2 = OpVariable %_ptr_Output_v2uint Output %12
+%_ptr_Output_int = OpTypePointer Output %int
+%tint_symbol_3 = OpVariable %_ptr_Output_int Output %16
+%_ptr_Output_v2int = OpTypePointer Output %v2int
+%tint_symbol_4 = OpVariable %_ptr_Output_v2int Output %20
+%tint_symbol_5 = OpVariable %_ptr_Output_float Output %4
+%_ptr_Output_v2float = OpTypePointer Output %v2float
+%tint_symbol_6 = OpVariable %_ptr_Output_v2float Output %26
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_7 = OpVariable %_ptr_Output_v4float Output %30
+ %void = OpTypeVoid
+ %44 = OpTypeFunction %void
+ %main_out = OpTypeStruct %uint %v2uint %int %v2int %float %v2float %v4float
+ %48 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %44
+ %47 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_8 = OpFunction %void None %48
+%tint_symbol = OpFunctionParameter %main_out
+ %52 = OpLabel
+ %53 = OpCompositeExtract %uint %tint_symbol 0
+ OpStore %tint_symbol_1 %53
+ %54 = OpCompositeExtract %v2uint %tint_symbol 1
+ OpStore %tint_symbol_2 %54
+ %55 = OpCompositeExtract %int %tint_symbol 2
+ OpStore %tint_symbol_3 %55
+ %56 = OpCompositeExtract %v2int %tint_symbol 3
+ OpStore %tint_symbol_4 %56
+ %57 = OpCompositeExtract %float %tint_symbol 4
+ OpStore %tint_symbol_5 %57
+ %58 = OpCompositeExtract %v2float %tint_symbol 5
+ OpStore %tint_symbol_6 %58
+ %59 = OpCompositeExtract %v4float %tint_symbol 6
+ OpStore %tint_symbol_7 %59
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %44
+ %61 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %63 = OpFunctionCall %void %main_1
+ %65 = OpLoad %uint %x_1
+ %66 = OpLoad %v2uint %x_2
+ %67 = OpLoad %int %x_3
+ %68 = OpLoad %v2int %x_4
+ %69 = OpLoad %float %x_5
+ %70 = OpLoad %v2float %x_6
+ %71 = OpLoad %v4float %x_8
+ %72 = OpCompositeConstruct %main_out %65 %66 %67 %68 %69 %70 %71
+ %64 = OpFunctionCall %void %tint_symbol_8 %72
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.wgsl
new file mode 100644
index 0000000..06f66ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.wgsl
@@ -0,0 +1,40 @@
+var<private> x_1 : u32;
+
+var<private> x_2 : vec2<u32>;
+
+var<private> x_3 : i32;
+
+var<private> x_4 : vec2<i32>;
+
+var<private> x_5 : f32;
+
+var<private> x_6 : vec2<f32>;
+
+var<private> x_8 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[location(1)]]
+ x_1_1 : u32;
+ [[location(2)]]
+ x_2_1 : vec2<u32>;
+ [[location(3)]]
+ x_3_1 : i32;
+ [[location(4)]]
+ x_4_1 : vec2<i32>;
+ [[location(5), interpolate(flat)]]
+ x_5_1 : f32;
+ [[location(6), interpolate(flat)]]
+ x_6_1 : vec2<f32>;
+ [[builtin(position)]]
+ x_8_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_1, x_2, x_3, x_4, x_5, x_6, x_8);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm
new file mode 100644
index 0000000..cd74957
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm
@@ -0,0 +1,61 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 35
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %7 "main" %1 %2 %3 %4 %5 %6
+OpExecutionMode %7 OriginUpperLeft
+OpDecorate %1 Location 1
+OpDecorate %2 Location 2
+OpDecorate %3 Location 3
+OpDecorate %4 Location 4
+OpDecorate %5 Location 5
+OpDecorate %6 Location 6
+OpDecorate %2 Centroid
+OpDecorate %3 Sample
+OpDecorate %4 NoPerspective
+OpDecorate %5 NoPerspective
+OpDecorate %5 Centroid
+OpDecorate %6 NoPerspective
+OpDecorate %6 Sample
+%void = OpTypeVoid
+%9 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Input_float = OpTypePointer Input %float
+%1 = OpVariable %_ptr_Input_float Input
+%2 = OpVariable %_ptr_Input_float Input
+%3 = OpVariable %_ptr_Input_float Input
+%4 = OpVariable %_ptr_Input_float Input
+%5 = OpVariable %_ptr_Input_float Input
+%6 = OpVariable %_ptr_Input_float Input
+%7 = OpFunction %void None %9
+%34 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.hlsl
new file mode 100644
index 0000000..0c3175a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.hlsl
@@ -0,0 +1,36 @@
+static float x_1 = 0.0f;
+static float x_2 = 0.0f;
+static float x_3 = 0.0f;
+static float x_4 = 0.0f;
+static float x_5 = 0.0f;
+static float x_6 = 0.0f;
+
+void main_1() {
+ return;
+}
+
+struct tint_symbol_1 {
+ float x_1_param : TEXCOORD1;
+ linear centroid float x_2_param : TEXCOORD2;
+ linear sample float x_3_param : TEXCOORD3;
+ noperspective float x_4_param : TEXCOORD4;
+ noperspective centroid float x_5_param : TEXCOORD5;
+ noperspective sample float x_6_param : TEXCOORD6;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const float x_1_param = tint_symbol.x_1_param;
+ const float x_2_param = tint_symbol.x_2_param;
+ const float x_3_param = tint_symbol.x_3_param;
+ const float x_4_param = tint_symbol.x_4_param;
+ const float x_5_param = tint_symbol.x_5_param;
+ const float x_6_param = tint_symbol.x_6_param;
+ x_1 = x_1_param;
+ x_2 = x_2_param;
+ x_3 = x_3_param;
+ x_4 = x_4_param;
+ x_5 = x_5_param;
+ x_6 = x_6_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.msl
new file mode 100644
index 0000000..783515b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.msl
@@ -0,0 +1,39 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_2 {
+ float x_1_param [[user(locn1)]];
+ float x_2_param [[user(locn2)]] [[centroid_perspective]];
+ float x_3_param [[user(locn3)]] [[sample_perspective]];
+ float x_4_param [[user(locn4)]] [[no_perspective]];
+ float x_5_param [[user(locn5)]] [[centroid_no_perspective]];
+ float x_6_param [[user(locn6)]] [[sample_no_perspective]];
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ thread float tint_symbol_3 = 0.0f;
+ thread float tint_symbol_4 = 0.0f;
+ thread float tint_symbol_5 = 0.0f;
+ thread float tint_symbol_6 = 0.0f;
+ thread float tint_symbol_7 = 0.0f;
+ thread float tint_symbol_8 = 0.0f;
+ float const x_1_param = tint_symbol_1.x_1_param;
+ float const x_2_param = tint_symbol_1.x_2_param;
+ float const x_3_param = tint_symbol_1.x_3_param;
+ float const x_4_param = tint_symbol_1.x_4_param;
+ float const x_5_param = tint_symbol_1.x_5_param;
+ float const x_6_param = tint_symbol_1.x_6_param;
+ tint_symbol_3 = x_1_param;
+ tint_symbol_4 = x_2_param;
+ tint_symbol_5 = x_3_param;
+ tint_symbol_6 = x_4_param;
+ tint_symbol_7 = x_5_param;
+ tint_symbol_8 = x_6_param;
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.spvasm
new file mode 100644
index 0000000..a5b6742
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampleRateShading
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_1 %tint_symbol_2 %tint_symbol_3 %tint_symbol_4 %tint_symbol_5
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %x_3 "x_3"
+ OpName %x_4 "x_4"
+ OpName %x_5 "x_5"
+ OpName %x_6 "x_6"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %tint_symbol_5 "tint_symbol_5"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol Location 1
+ OpDecorate %tint_symbol_1 Location 2
+ OpDecorate %tint_symbol_1 Centroid
+ OpDecorate %tint_symbol_2 Location 3
+ OpDecorate %tint_symbol_2 Sample
+ OpDecorate %tint_symbol_3 Location 4
+ OpDecorate %tint_symbol_3 NoPerspective
+ OpDecorate %tint_symbol_4 Location 5
+ OpDecorate %tint_symbol_4 NoPerspective
+ OpDecorate %tint_symbol_4 Centroid
+ OpDecorate %tint_symbol_5 Location 6
+ OpDecorate %tint_symbol_5 NoPerspective
+ OpDecorate %tint_symbol_5 Sample
+ %float = OpTypeFloat 32
+%_ptr_Private_float = OpTypePointer Private %float
+ %4 = OpConstantNull %float
+ %x_1 = OpVariable %_ptr_Private_float Private %4
+ %x_2 = OpVariable %_ptr_Private_float Private %4
+ %x_3 = OpVariable %_ptr_Private_float Private %4
+ %x_4 = OpVariable %_ptr_Private_float Private %4
+ %x_5 = OpVariable %_ptr_Private_float Private %4
+ %x_6 = OpVariable %_ptr_Private_float Private %4
+%_ptr_Input_float = OpTypePointer Input %float
+%tint_symbol = OpVariable %_ptr_Input_float Input
+%tint_symbol_1 = OpVariable %_ptr_Input_float Input
+%tint_symbol_2 = OpVariable %_ptr_Input_float Input
+%tint_symbol_3 = OpVariable %_ptr_Input_float Input
+%tint_symbol_4 = OpVariable %_ptr_Input_float Input
+%tint_symbol_5 = OpVariable %_ptr_Input_float Input
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %22 = OpLabel
+ %23 = OpLoad %float %tint_symbol
+ OpStore %x_1 %23
+ %24 = OpLoad %float %tint_symbol_1
+ OpStore %x_2 %24
+ %25 = OpLoad %float %tint_symbol_2
+ OpStore %x_3 %25
+ %26 = OpLoad %float %tint_symbol_3
+ OpStore %x_4 %26
+ %27 = OpLoad %float %tint_symbol_4
+ OpStore %x_5 %27
+ %28 = OpLoad %float %tint_symbol_5
+ OpStore %x_6 %28
+ %29 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.wgsl
new file mode 100644
index 0000000..aad5228
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.wgsl
@@ -0,0 +1,26 @@
+var<private> x_1 : f32;
+
+var<private> x_2 : f32;
+
+var<private> x_3 : f32;
+
+var<private> x_4 : f32;
+
+var<private> x_5 : f32;
+
+var<private> x_6 : f32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[location(1)]] x_1_param : f32, [[location(2), interpolate(perspective, centroid)]] x_2_param : f32, [[location(3), interpolate(perspective, sample)]] x_3_param : f32, [[location(4), interpolate(linear)]] x_4_param : f32, [[location(5), interpolate(linear, centroid)]] x_5_param : f32, [[location(6), interpolate(linear, sample)]] x_6_param : f32) {
+ x_1 = x_1_param;
+ x_2 = x_2_param;
+ x_3 = x_3_param;
+ x_4 = x_4_param;
+ x_5 = x_5_param;
+ x_6 = x_6_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm
new file mode 100644
index 0000000..ea0075e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm
@@ -0,0 +1,61 @@
+; Test: SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 35
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %7 "main" %1 %2 %3 %4 %5 %6
+OpExecutionMode %7 OriginUpperLeft
+OpDecorate %1 Location 1
+OpDecorate %2 Location 2
+OpDecorate %3 Location 3
+OpDecorate %4 Location 4
+OpDecorate %5 Location 5
+OpDecorate %6 Location 6
+OpDecorate %2 Centroid
+OpDecorate %3 Sample
+OpDecorate %4 NoPerspective
+OpDecorate %5 NoPerspective
+OpDecorate %5 Centroid
+OpDecorate %6 NoPerspective
+OpDecorate %6 Sample
+%void = OpTypeVoid
+%9 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Output_float = OpTypePointer Output %float
+%1 = OpVariable %_ptr_Output_float Output
+%2 = OpVariable %_ptr_Output_float Output
+%3 = OpVariable %_ptr_Output_float Output
+%4 = OpVariable %_ptr_Output_float Output
+%5 = OpVariable %_ptr_Output_float Output
+%6 = OpVariable %_ptr_Output_float Output
+%7 = OpFunction %void None %9
+%34 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.hlsl
new file mode 100644
index 0000000..2832006
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.hlsl
@@ -0,0 +1,34 @@
+static float x_1 = 0.0f;
+static float x_2 = 0.0f;
+static float x_3 = 0.0f;
+static float x_4 = 0.0f;
+static float x_5 = 0.0f;
+static float x_6 = 0.0f;
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float x_1_1;
+ float x_2_1;
+ float x_3_1;
+ float x_4_1;
+ float x_5_1;
+ float x_6_1;
+};
+struct tint_symbol {
+ float x_1_1 : SV_Target1;
+ linear centroid float x_2_1 : SV_Target2;
+ linear sample float x_3_1 : SV_Target3;
+ noperspective float x_4_1 : SV_Target4;
+ noperspective centroid float x_5_1 : SV_Target5;
+ noperspective sample float x_6_1 : SV_Target6;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_1, x_2, x_3, x_4, x_5, x_6};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1, tint_symbol_1.x_2_1, tint_symbol_1.x_3_1, tint_symbol_1.x_4_1, tint_symbol_1.x_5_1, tint_symbol_1.x_6_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.msl
new file mode 100644
index 0000000..f4302dc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.msl
@@ -0,0 +1,37 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float x_1_1;
+ float x_2_1;
+ float x_3_1;
+ float x_4_1;
+ float x_5_1;
+ float x_6_1;
+};
+struct tint_symbol_1 {
+ float x_1_1 [[color(1)]];
+ float x_2_1 [[color(2)]] [[centroid_perspective]];
+ float x_3_1 [[color(3)]] [[sample_perspective]];
+ float x_4_1 [[color(4)]] [[no_perspective]];
+ float x_5_1 [[color(5)]] [[centroid_no_perspective]];
+ float x_6_1 [[color(6)]] [[sample_no_perspective]];
+};
+
+void main_1() {
+ return;
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ thread float tint_symbol_4 = 0.0f;
+ thread float tint_symbol_5 = 0.0f;
+ thread float tint_symbol_6 = 0.0f;
+ thread float tint_symbol_7 = 0.0f;
+ thread float tint_symbol_8 = 0.0f;
+ thread float tint_symbol_9 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.x_1_1=tint_symbol_4, .x_2_1=tint_symbol_5, .x_3_1=tint_symbol_6, .x_4_1=tint_symbol_7, .x_5_1=tint_symbol_8, .x_6_1=tint_symbol_9};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1, .x_2_1=tint_symbol_2.x_2_1, .x_3_1=tint_symbol_2.x_3_1, .x_4_1=tint_symbol_2.x_4_1, .x_5_1=tint_symbol_2.x_5_1, .x_6_1=tint_symbol_2.x_6_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.spvasm
new file mode 100644
index 0000000..ce9d79a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.spvasm
@@ -0,0 +1,106 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampleRateShading
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol_1 %tint_symbol_2 %tint_symbol_3 %tint_symbol_4 %tint_symbol_5 %tint_symbol_6
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %x_3 "x_3"
+ OpName %x_4 "x_4"
+ OpName %x_5 "x_5"
+ OpName %x_6 "x_6"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %tint_symbol_5 "tint_symbol_5"
+ OpName %tint_symbol_6 "tint_symbol_6"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpMemberName %main_out 1 "x_2_1"
+ OpMemberName %main_out 2 "x_3_1"
+ OpMemberName %main_out 3 "x_4_1"
+ OpMemberName %main_out 4 "x_5_1"
+ OpMemberName %main_out 5 "x_6_1"
+ OpName %tint_symbol_7 "tint_symbol_7"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_symbol_1 Location 1
+ OpDecorate %tint_symbol_2 Location 2
+ OpDecorate %tint_symbol_2 Centroid
+ OpDecorate %tint_symbol_3 Location 3
+ OpDecorate %tint_symbol_3 Sample
+ OpDecorate %tint_symbol_4 Location 4
+ OpDecorate %tint_symbol_4 NoPerspective
+ OpDecorate %tint_symbol_5 Location 5
+ OpDecorate %tint_symbol_5 NoPerspective
+ OpDecorate %tint_symbol_5 Centroid
+ OpDecorate %tint_symbol_6 Location 6
+ OpDecorate %tint_symbol_6 NoPerspective
+ OpDecorate %tint_symbol_6 Sample
+ OpMemberDecorate %main_out 0 Offset 0
+ OpMemberDecorate %main_out 1 Offset 4
+ OpMemberDecorate %main_out 2 Offset 8
+ OpMemberDecorate %main_out 3 Offset 12
+ OpMemberDecorate %main_out 4 Offset 16
+ OpMemberDecorate %main_out 5 Offset 20
+ %float = OpTypeFloat 32
+%_ptr_Private_float = OpTypePointer Private %float
+ %4 = OpConstantNull %float
+ %x_1 = OpVariable %_ptr_Private_float Private %4
+ %x_2 = OpVariable %_ptr_Private_float Private %4
+ %x_3 = OpVariable %_ptr_Private_float Private %4
+ %x_4 = OpVariable %_ptr_Private_float Private %4
+ %x_5 = OpVariable %_ptr_Private_float Private %4
+ %x_6 = OpVariable %_ptr_Private_float Private %4
+%_ptr_Output_float = OpTypePointer Output %float
+%tint_symbol_1 = OpVariable %_ptr_Output_float Output %4
+%tint_symbol_2 = OpVariable %_ptr_Output_float Output %4
+%tint_symbol_3 = OpVariable %_ptr_Output_float Output %4
+%tint_symbol_4 = OpVariable %_ptr_Output_float Output %4
+%tint_symbol_5 = OpVariable %_ptr_Output_float Output %4
+%tint_symbol_6 = OpVariable %_ptr_Output_float Output %4
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_out = OpTypeStruct %float %float %float %float %float %float
+ %21 = OpTypeFunction %void %main_out
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_7 = OpFunction %void None %21
+%tint_symbol = OpFunctionParameter %main_out
+ %25 = OpLabel
+ %26 = OpCompositeExtract %float %tint_symbol 0
+ OpStore %tint_symbol_1 %26
+ %27 = OpCompositeExtract %float %tint_symbol 1
+ OpStore %tint_symbol_2 %27
+ %28 = OpCompositeExtract %float %tint_symbol 2
+ OpStore %tint_symbol_3 %28
+ %29 = OpCompositeExtract %float %tint_symbol 3
+ OpStore %tint_symbol_4 %29
+ %30 = OpCompositeExtract %float %tint_symbol 4
+ OpStore %tint_symbol_5 %30
+ %31 = OpCompositeExtract %float %tint_symbol 5
+ OpStore %tint_symbol_6 %31
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %main_1
+ %36 = OpLoad %float %x_1
+ %37 = OpLoad %float %x_2
+ %38 = OpLoad %float %x_3
+ %39 = OpLoad %float %x_4
+ %40 = OpLoad %float %x_5
+ %41 = OpLoad %float %x_6
+ %42 = OpCompositeConstruct %main_out %36 %37 %38 %39 %40 %41
+ %35 = OpFunctionCall %void %tint_symbol_7 %42
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.wgsl
new file mode 100644
index 0000000..3229335
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.wgsl
@@ -0,0 +1,36 @@
+var<private> x_1 : f32;
+
+var<private> x_2 : f32;
+
+var<private> x_3 : f32;
+
+var<private> x_4 : f32;
+
+var<private> x_5 : f32;
+
+var<private> x_6 : f32;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[location(1)]]
+ x_1_1 : f32;
+ [[location(2), interpolate(perspective, centroid)]]
+ x_2_1 : f32;
+ [[location(3), interpolate(perspective, sample)]]
+ x_3_1 : f32;
+ [[location(4), interpolate(linear)]]
+ x_4_1 : f32;
+ [[location(5), interpolate(linear, centroid)]]
+ x_5_1 : f32;
+ [[location(6), interpolate(linear, sample)]]
+ x_6_1 : f32;
+};
+
+[[stage(fragment)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_1, x_2, x_3, x_4, x_5, x_6);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm
new file mode 100644
index 0000000..e74d30e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm
@@ -0,0 +1,32 @@
+; Test: SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %4 "main" %1 %gl_Position %3
+OpName %Communicators "Communicators"
+OpMemberName %Communicators 0 "alice"
+OpMemberName %Communicators 1 "bob"
+OpMemberDecorate %Communicators 0 Location 9
+OpMemberDecorate %Communicators 1 Location 11
+OpDecorate %Communicators Block
+OpDecorate %gl_Position BuiltIn Position
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%Communicators = OpTypeStruct %float %v4float
+%_ptr_Input_Communicators = OpTypePointer Input %Communicators
+%_ptr_Output_Communicators = OpTypePointer Output %Communicators
+%1 = OpVariable %_ptr_Input_Communicators Input
+%3 = OpVariable %_ptr_Output_Communicators Output
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%4 = OpFunction %void None %7
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.hlsl
new file mode 100644
index 0000000..0903e46
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.hlsl
@@ -0,0 +1,38 @@
+struct Communicators {
+ float alice;
+ float4 bob;
+};
+
+static Communicators x_1 = (Communicators)0;
+static Communicators x_3 = (Communicators)0;
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 x_2_1;
+ float x_3_1;
+ float4 x_3_2;
+};
+struct tint_symbol_1 {
+ float x_1_param : TEXCOORD9;
+ float4 x_1_param_1 : TEXCOORD11;
+};
+struct tint_symbol_2 {
+ float x_3_1 : TEXCOORD9;
+ float4 x_3_2 : TEXCOORD11;
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const float x_1_param = tint_symbol.x_1_param;
+ const float4 x_1_param_1 = tint_symbol.x_1_param_1;
+ x_1.alice = x_1_param;
+ x_1.bob = x_1_param_1;
+ main_1();
+ const main_out tint_symbol_3 = {x_2, x_3.alice, x_3.bob};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_3_1, tint_symbol_3.x_3_2, tint_symbol_3.x_2_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.msl
new file mode 100644
index 0000000..bbe3dc4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.msl
@@ -0,0 +1,40 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct Communicators {
+ float alice;
+ float4 bob;
+};
+struct main_out {
+ float4 x_2_1;
+ float x_3_1;
+ float4 x_3_2;
+};
+struct tint_symbol_2 {
+ float x_1_param [[attribute(9)]];
+ float4 x_1_param_1 [[attribute(11)]];
+};
+struct tint_symbol_3 {
+ float x_3_1 [[user(locn9)]];
+ float4 x_3_2 [[user(locn11)]];
+ float4 x_2_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ thread Communicators tint_symbol_6 = {};
+ thread float4 tint_symbol_7 = 0.0f;
+ thread Communicators tint_symbol_8 = {};
+ float const x_1_param = tint_symbol_1.x_1_param;
+ float4 const x_1_param_1 = tint_symbol_1.x_1_param_1;
+ tint_symbol_6.alice = x_1_param;
+ tint_symbol_6.bob = x_1_param_1;
+ main_1();
+ main_out const tint_symbol_4 = {.x_2_1=tint_symbol_7, .x_3_1=tint_symbol_8.alice, .x_3_2=tint_symbol_8.bob};
+ tint_symbol_3 const tint_symbol_5 = {.x_3_1=tint_symbol_4.x_3_1, .x_3_2=tint_symbol_4.x_3_2, .x_2_1=tint_symbol_4.x_2_1};
+ return tint_symbol_5;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.spvasm
new file mode 100644
index 0000000..1fb50f3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.spvasm
@@ -0,0 +1,103 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 53
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_1 %tint_symbol_3 %tint_symbol_4 %tint_symbol_5
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %Communicators "Communicators"
+ OpMemberName %Communicators 0 "alice"
+ OpMemberName %Communicators 1 "bob"
+ OpName %x_1 "x_1"
+ OpName %x_3 "x_3"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %tint_symbol_5 "tint_symbol_5"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_2_1"
+ OpMemberName %main_out 1 "x_3_1"
+ OpMemberName %main_out 2 "x_3_2"
+ OpName %tint_symbol_6 "tint_symbol_6"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpMemberDecorate %Communicators 0 Offset 0
+ OpMemberDecorate %Communicators 1 Offset 16
+ OpDecorate %tint_symbol Location 9
+ OpDecorate %tint_symbol_1 Location 11
+ OpDecorate %tint_symbol_3 BuiltIn Position
+ OpDecorate %tint_symbol_4 Location 9
+ OpDecorate %tint_symbol_5 Location 11
+ OpMemberDecorate %main_out 0 Offset 0
+ OpMemberDecorate %main_out 1 Offset 16
+ OpMemberDecorate %main_out 2 Offset 32
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%Communicators = OpTypeStruct %float %v4float
+%_ptr_Private_Communicators = OpTypePointer Private %Communicators
+ %9 = OpConstantNull %Communicators
+ %x_1 = OpVariable %_ptr_Private_Communicators Private %9
+ %x_3 = OpVariable %_ptr_Private_Communicators Private %9
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %13 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %13
+%_ptr_Input_float = OpTypePointer Input %float
+%tint_symbol = OpVariable %_ptr_Input_float Input
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%tint_symbol_1 = OpVariable %_ptr_Input_v4float Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %13
+%tint_symbol_4 = OpVariable %_ptr_Output_float Output %4
+%tint_symbol_5 = OpVariable %_ptr_Output_v4float Output %13
+ %void = OpTypeVoid
+ %22 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float %float %v4float
+ %26 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_Private_float = OpTypePointer Private %float
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %22
+ %25 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_6 = OpFunction %void None %26
+%tint_symbol_2 = OpFunctionParameter %main_out
+ %30 = OpLabel
+ %31 = OpCompositeExtract %v4float %tint_symbol_2 0
+ OpStore %tint_symbol_3 %31
+ %32 = OpCompositeExtract %float %tint_symbol_2 1
+ OpStore %tint_symbol_4 %32
+ %33 = OpCompositeExtract %v4float %tint_symbol_2 2
+ OpStore %tint_symbol_5 %33
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %22
+ %35 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %40 = OpAccessChain %_ptr_Private_float %x_1 %uint_0
+ %41 = OpLoad %float %tint_symbol
+ OpStore %40 %41
+ %43 = OpAccessChain %_ptr_Private_v4float %x_1 %uint_1
+ %44 = OpLoad %v4float %tint_symbol_1
+ OpStore %43 %44
+ %45 = OpFunctionCall %void %main_1
+ %47 = OpLoad %v4float %x_2
+ %48 = OpAccessChain %_ptr_Private_float %x_3 %uint_0
+ %49 = OpLoad %float %48
+ %50 = OpAccessChain %_ptr_Private_v4float %x_3 %uint_1
+ %51 = OpLoad %v4float %50
+ %52 = OpCompositeConstruct %main_out %47 %49 %51
+ %46 = OpFunctionCall %void %tint_symbol_6 %52
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.wgsl
new file mode 100644
index 0000000..67fb380
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+struct Communicators {
+ alice : f32;
+ bob : vec4<f32>;
+};
+
+var<private> x_1 : Communicators;
+
+var<private> x_3 : Communicators;
+
+var<private> x_2 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+ [[location(9)]]
+ x_3_1 : f32;
+ [[location(11)]]
+ x_3_2 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[location(9)]] x_1_param : f32, [[location(11)]] x_1_param_1 : vec4<f32>) -> main_out {
+ x_1.alice = x_1_param;
+ x_1.bob = x_1_param_1;
+ main_1();
+ return main_out(x_2, x_3.alice, x_3.bob);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm
new file mode 100644
index 0000000..0a681c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm
@@ -0,0 +1,42 @@
+; Test: SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 30
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Input_uint = OpTypePointer Input %uint
+%1 = OpVariable %_ptr_Input_uint Input
+%2 = OpFunction %void None %4
+%29 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.hlsl
new file mode 100644
index 0000000..415c810
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint x_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.spvasm
new file mode 100644
index 0000000..de87216
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.wgsl
new file mode 100644
index 0000000..21b73b3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm
new file mode 100644
index 0000000..864e0ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 16
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %1 %gl_Position
+OpDecorate %1 Location 4
+OpDecorate %gl_Position BuiltIn Position
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_3 = OpConstant %uint 3
+%_arr_float_uint_3 = OpTypeArray %float %uint_3
+%_ptr_Input__arr_float_uint_3 = OpTypePointer Input %_arr_float_uint_3
+%1 = OpVariable %_ptr_Input__arr_float_uint_3 Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %5
+%15 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.hlsl
new file mode 100644
index 0000000..0d79f1a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.hlsl
@@ -0,0 +1,31 @@
+static float x_1[3] = (float[3])0;
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_1 {
+ float x_1_param : TEXCOORD4;
+ float x_1_param_1 : TEXCOORD5;
+ float x_1_param_2 : TEXCOORD6;
+};
+struct tint_symbol_2 {
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const float x_1_param = tint_symbol.x_1_param;
+ const float x_1_param_1 = tint_symbol.x_1_param_1;
+ const float x_1_param_2 = tint_symbol.x_1_param_2;
+ x_1[0] = x_1_param;
+ x_1[1] = x_1_param_1;
+ x_1[2] = x_1_param_2;
+ main_1();
+ const main_out tint_symbol_3 = {x_2};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_2_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.msl
new file mode 100644
index 0000000..8afc07a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.msl
@@ -0,0 +1,37 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ float arr[3];
+};
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_2 {
+ float x_1_param [[attribute(4)]];
+ float x_1_param_1 [[attribute(5)]];
+ float x_1_param_2 [[attribute(6)]];
+};
+struct tint_symbol_3 {
+ float4 x_2_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ thread tint_array_wrapper tint_symbol_6 = {};
+ thread float4 tint_symbol_7 = 0.0f;
+ float const x_1_param = tint_symbol_1.x_1_param;
+ float const x_1_param_1 = tint_symbol_1.x_1_param_1;
+ float const x_1_param_2 = tint_symbol_1.x_1_param_2;
+ tint_symbol_6.arr[0] = x_1_param;
+ tint_symbol_6.arr[1] = x_1_param_1;
+ tint_symbol_6.arr[2] = x_1_param_2;
+ main_1();
+ main_out const tint_symbol_4 = {.x_2_1=tint_symbol_7};
+ tint_symbol_3 const tint_symbol_5 = {.x_2_1=tint_symbol_4.x_2_1};
+ return tint_symbol_5;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.spvasm
new file mode 100644
index 0000000..280aeff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_1 %tint_symbol_2 %tint_symbol_4
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_2_1"
+ OpName %tint_symbol_5 "tint_symbol_5"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %_arr_float_uint_3 ArrayStride 4
+ OpDecorate %tint_symbol Location 4
+ OpDecorate %tint_symbol_1 Location 5
+ OpDecorate %tint_symbol_2 Location 6
+ OpDecorate %tint_symbol_4 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+ %uint_3 = OpConstant %uint 3
+%_arr_float_uint_3 = OpTypeArray %float %uint_3
+%_ptr_Private__arr_float_uint_3 = OpTypePointer Private %_arr_float_uint_3
+ %10 = OpConstantNull %_arr_float_uint_3
+ %x_1 = OpVariable %_ptr_Private__arr_float_uint_3 Private %10
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %14 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %14
+%_ptr_Input_float = OpTypePointer Input %float
+%tint_symbol = OpVariable %_ptr_Input_float Input
+%tint_symbol_1 = OpVariable %_ptr_Input_float Input
+%tint_symbol_2 = OpVariable %_ptr_Input_float Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_4 = OpVariable %_ptr_Output_v4float Output %14
+ %void = OpTypeVoid
+ %21 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %25 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_float = OpTypePointer Private %float
+ %int_1 = OpConstant %int 1
+ %int_2 = OpConstant %int 2
+ %main_1 = OpFunction %void None %21
+ %24 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_5 = OpFunction %void None %25
+%tint_symbol_3 = OpFunctionParameter %main_out
+ %29 = OpLabel
+ %30 = OpCompositeExtract %v4float %tint_symbol_3 0
+ OpStore %tint_symbol_4 %30
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %21
+ %32 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %37 = OpAccessChain %_ptr_Private_float %x_1 %int_0
+ %38 = OpLoad %float %tint_symbol
+ OpStore %37 %38
+ %40 = OpAccessChain %_ptr_Private_float %x_1 %int_1
+ %41 = OpLoad %float %tint_symbol_1
+ OpStore %40 %41
+ %43 = OpAccessChain %_ptr_Private_float %x_1 %int_2
+ %44 = OpLoad %float %tint_symbol_2
+ OpStore %43 %44
+ %45 = OpFunctionCall %void %main_1
+ %47 = OpLoad %v4float %x_2
+ %48 = OpCompositeConstruct %main_out %47
+ %46 = OpFunctionCall %void %tint_symbol_5 %48
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.wgsl
new file mode 100644
index 0000000..70c14aa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> x_1 : array<f32, 3>;
+
+var<private> x_2 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[location(4)]] x_1_param : f32, [[location(5)]] x_1_param_1 : f32, [[location(6)]] x_1_param_2 : f32) -> main_out {
+ x_1[0] = x_1_param;
+ x_1[1] = x_1_param_1;
+ x_1[2] = x_1_param_2;
+ main_1();
+ return main_out(x_2);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm
new file mode 100644
index 0000000..e893356
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm
@@ -0,0 +1,26 @@
+; Test: SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %1 %gl_Position
+OpDecorate %1 Location 9
+OpDecorate %gl_Position BuiltIn Position
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%mat2v4float = OpTypeMatrix %v4float 2
+%uint = OpTypeInt 32 0
+%_ptr_Input_mat2v4float = OpTypePointer Input %mat2v4float
+%1 = OpVariable %_ptr_Input_mat2v4float Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %5
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.hlsl
new file mode 100644
index 0000000..3165ed2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+static float2x4 x_1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_1 {
+ float4 x_1_param : TEXCOORD9;
+ float4 x_1_param_1 : TEXCOORD10;
+};
+struct tint_symbol_2 {
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const float4 x_1_param = tint_symbol.x_1_param;
+ const float4 x_1_param_1 = tint_symbol.x_1_param_1;
+ x_1[0] = x_1_param;
+ x_1[1] = x_1_param_1;
+ main_1();
+ const main_out tint_symbol_3 = {x_2};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_2_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.msl
new file mode 100644
index 0000000..b65de15
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.msl
@@ -0,0 +1,31 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_2 {
+ float4 x_1_param [[attribute(9)]];
+ float4 x_1_param_1 [[attribute(10)]];
+};
+struct tint_symbol_3 {
+ float4 x_2_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ thread float2x4 tint_symbol_6 = float2x4(0.0f);
+ thread float4 tint_symbol_7 = 0.0f;
+ float4 const x_1_param = tint_symbol_1.x_1_param;
+ float4 const x_1_param_1 = tint_symbol_1.x_1_param_1;
+ tint_symbol_6[0] = x_1_param;
+ tint_symbol_6[1] = x_1_param_1;
+ main_1();
+ main_out const tint_symbol_4 = {.x_2_1=tint_symbol_7};
+ tint_symbol_3 const tint_symbol_5 = {.x_2_1=tint_symbol_4.x_2_1};
+ return tint_symbol_5;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.spvasm
new file mode 100644
index 0000000..34cb4ed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_1 %tint_symbol_3
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_2_1"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol Location 9
+ OpDecorate %tint_symbol_1 Location 10
+ OpDecorate %tint_symbol_3 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%mat2v4float = OpTypeMatrix %v4float 2
+%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
+ %9 = OpConstantNull %mat2v4float
+ %x_1 = OpVariable %_ptr_Private_mat2v4float Private %9
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %12
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%tint_symbol = OpVariable %_ptr_Input_v4float Input
+%tint_symbol_1 = OpVariable %_ptr_Input_v4float Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %18 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %22 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+ %int_1 = OpConstant %int 1
+ %main_1 = OpFunction %void None %18
+ %21 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_4 = OpFunction %void None %22
+%tint_symbol_2 = OpFunctionParameter %main_out
+ %26 = OpLabel
+ %27 = OpCompositeExtract %v4float %tint_symbol_2 0
+ OpStore %tint_symbol_3 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %18
+ %29 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %33 = OpAccessChain %_ptr_Private_v4float %x_1 %int_0
+ %34 = OpLoad %v4float %tint_symbol
+ OpStore %33 %34
+ %36 = OpAccessChain %_ptr_Private_v4float %x_1 %int_1
+ %37 = OpLoad %v4float %tint_symbol_1
+ OpStore %36 %37
+ %38 = OpFunctionCall %void %main_1
+ %40 = OpLoad %v4float %x_2
+ %41 = OpCompositeConstruct %main_out %40
+ %39 = OpFunctionCall %void %tint_symbol_4 %41
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.wgsl
new file mode 100644
index 0000000..d101097
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> x_1 : mat2x4<f32>;
+
+var<private> x_2 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[location(9)]] x_1_param : vec4<f32>, [[location(10)]] x_1_param_1 : vec4<f32>) -> main_out {
+ x_1[0] = x_1_param;
+ x_1[1] = x_1_param_1;
+ main_1();
+ return main_out(x_2);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm
new file mode 100644
index 0000000..15c3f9b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 15
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %1 %gl_Position
+OpDecorate %1 Location 7
+OpDecorate %gl_Position BuiltIn Position
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%mat2v4float = OpTypeMatrix %v4float 2
+%uint = OpTypeInt 32 0
+%uint_2 = OpConstant %uint 2
+%_arr_mat2v4float_uint_2 = OpTypeArray %mat2v4float %uint_2
+%_ptr_Input__arr_mat2v4float_uint_2 = OpTypePointer Input %_arr_mat2v4float_uint_2
+%1 = OpVariable %_ptr_Input__arr_mat2v4float_uint_2 Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %5
+%14 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.hlsl
new file mode 100644
index 0000000..14b0548
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.hlsl
@@ -0,0 +1,34 @@
+static float2x4 x_1[2] = (float2x4[2])0;
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_1 {
+ float4 x_1_param : TEXCOORD7;
+ float4 x_1_param_1 : TEXCOORD8;
+ float4 x_1_param_2 : TEXCOORD9;
+ float4 x_1_param_3 : TEXCOORD10;
+};
+struct tint_symbol_2 {
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const float4 x_1_param = tint_symbol.x_1_param;
+ const float4 x_1_param_1 = tint_symbol.x_1_param_1;
+ const float4 x_1_param_2 = tint_symbol.x_1_param_2;
+ const float4 x_1_param_3 = tint_symbol.x_1_param_3;
+ x_1[0][0] = x_1_param;
+ x_1[0][1] = x_1_param_1;
+ x_1[1][0] = x_1_param_2;
+ x_1[1][1] = x_1_param_3;
+ main_1();
+ const main_out tint_symbol_3 = {x_2};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_2_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.msl
new file mode 100644
index 0000000..059776b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.msl
@@ -0,0 +1,40 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ float2x4 arr[2];
+};
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_2 {
+ float4 x_1_param [[attribute(7)]];
+ float4 x_1_param_1 [[attribute(8)]];
+ float4 x_1_param_2 [[attribute(9)]];
+ float4 x_1_param_3 [[attribute(10)]];
+};
+struct tint_symbol_3 {
+ float4 x_2_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ thread tint_array_wrapper tint_symbol_6 = {};
+ thread float4 tint_symbol_7 = 0.0f;
+ float4 const x_1_param = tint_symbol_1.x_1_param;
+ float4 const x_1_param_1 = tint_symbol_1.x_1_param_1;
+ float4 const x_1_param_2 = tint_symbol_1.x_1_param_2;
+ float4 const x_1_param_3 = tint_symbol_1.x_1_param_3;
+ tint_symbol_6.arr[0][0] = x_1_param;
+ tint_symbol_6.arr[0][1] = x_1_param_1;
+ tint_symbol_6.arr[1][0] = x_1_param_2;
+ tint_symbol_6.arr[1][1] = x_1_param_3;
+ main_1();
+ main_out const tint_symbol_4 = {.x_2_1=tint_symbol_7};
+ tint_symbol_3 const tint_symbol_5 = {.x_2_1=tint_symbol_4.x_2_1};
+ return tint_symbol_5;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.spvasm
new file mode 100644
index 0000000..b6bb3a7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.spvasm
@@ -0,0 +1,92 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_1 %tint_symbol_2 %tint_symbol_3 %tint_symbol_5
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_5 "tint_symbol_5"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_2_1"
+ OpName %tint_symbol_6 "tint_symbol_6"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %_arr_mat2v4float_uint_2 ArrayStride 32
+ OpDecorate %tint_symbol Location 7
+ OpDecorate %tint_symbol_1 Location 8
+ OpDecorate %tint_symbol_2 Location 9
+ OpDecorate %tint_symbol_3 Location 10
+ OpDecorate %tint_symbol_5 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%mat2v4float = OpTypeMatrix %v4float 2
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_arr_mat2v4float_uint_2 = OpTypeArray %mat2v4float %uint_2
+%_ptr_Private__arr_mat2v4float_uint_2 = OpTypePointer Private %_arr_mat2v4float_uint_2
+ %12 = OpConstantNull %_arr_mat2v4float_uint_2
+ %x_1 = OpVariable %_ptr_Private__arr_mat2v4float_uint_2 Private %12
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %15 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %15
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%tint_symbol = OpVariable %_ptr_Input_v4float Input
+%tint_symbol_1 = OpVariable %_ptr_Input_v4float Input
+%tint_symbol_2 = OpVariable %_ptr_Input_v4float Input
+%tint_symbol_3 = OpVariable %_ptr_Input_v4float Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_5 = OpVariable %_ptr_Output_v4float Output %15
+ %void = OpTypeVoid
+ %23 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %27 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+ %int_1 = OpConstant %int 1
+ %main_1 = OpFunction %void None %23
+ %26 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_6 = OpFunction %void None %27
+%tint_symbol_4 = OpFunctionParameter %main_out
+ %31 = OpLabel
+ %32 = OpCompositeExtract %v4float %tint_symbol_4 0
+ OpStore %tint_symbol_5 %32
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %23
+ %34 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %38 = OpAccessChain %_ptr_Private_v4float %x_1 %int_0 %int_0
+ %39 = OpLoad %v4float %tint_symbol
+ OpStore %38 %39
+ %41 = OpAccessChain %_ptr_Private_v4float %x_1 %int_0 %int_1
+ %42 = OpLoad %v4float %tint_symbol_1
+ OpStore %41 %42
+ %43 = OpAccessChain %_ptr_Private_v4float %x_1 %int_1 %int_0
+ %44 = OpLoad %v4float %tint_symbol_2
+ OpStore %43 %44
+ %45 = OpAccessChain %_ptr_Private_v4float %x_1 %int_1 %int_1
+ %46 = OpLoad %v4float %tint_symbol_3
+ OpStore %45 %46
+ %47 = OpFunctionCall %void %main_1
+ %49 = OpLoad %v4float %x_2
+ %50 = OpCompositeConstruct %main_out %49
+ %48 = OpFunctionCall %void %tint_symbol_6 %50
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.wgsl
new file mode 100644
index 0000000..d6d08ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+var<private> x_1 : array<mat2x4<f32>, 2>;
+
+var<private> x_2 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[location(7)]] x_1_param : vec4<f32>, [[location(8)]] x_1_param_1 : vec4<f32>, [[location(9)]] x_1_param_2 : vec4<f32>, [[location(10)]] x_1_param_3 : vec4<f32>) -> main_out {
+ x_1[0][0] = x_1_param;
+ x_1[0][1] = x_1_param_1;
+ x_1[1][0] = x_1_param_2;
+ x_1[1][1] = x_1_param_3;
+ main_1();
+ return main_out(x_2);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm
new file mode 100644
index 0000000..e780dfa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %1 %gl_Position
+OpName %Communicators "Communicators"
+OpMemberName %Communicators 0 "alice"
+OpMemberName %Communicators 1 "bob"
+OpDecorate %1 Location 9
+OpDecorate %gl_Position BuiltIn Position
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%Communicators = OpTypeStruct %float %v4float
+%_ptr_Input_Communicators = OpTypePointer Input %Communicators
+%1 = OpVariable %_ptr_Input_Communicators Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%9 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.hlsl
new file mode 100644
index 0000000..f8df6da
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.hlsl
@@ -0,0 +1,33 @@
+struct Communicators {
+ float alice;
+ float4 bob;
+};
+
+static Communicators x_1 = (Communicators)0;
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_1 {
+ float x_1_param : TEXCOORD9;
+ float4 x_1_param_1 : TEXCOORD10;
+};
+struct tint_symbol_2 {
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const float x_1_param = tint_symbol.x_1_param;
+ const float4 x_1_param_1 = tint_symbol.x_1_param_1;
+ x_1.alice = x_1_param;
+ x_1.bob = x_1_param_1;
+ main_1();
+ const main_out tint_symbol_3 = {x_2};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_2_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.msl
new file mode 100644
index 0000000..d95c9b2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct Communicators {
+ float alice;
+ float4 bob;
+};
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_2 {
+ float x_1_param [[attribute(9)]];
+ float4 x_1_param_1 [[attribute(10)]];
+};
+struct tint_symbol_3 {
+ float4 x_2_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ thread Communicators tint_symbol_6 = {};
+ thread float4 tint_symbol_7 = 0.0f;
+ float const x_1_param = tint_symbol_1.x_1_param;
+ float4 const x_1_param_1 = tint_symbol_1.x_1_param_1;
+ tint_symbol_6.alice = x_1_param;
+ tint_symbol_6.bob = x_1_param_1;
+ main_1();
+ main_out const tint_symbol_4 = {.x_2_1=tint_symbol_7};
+ tint_symbol_3 const tint_symbol_5 = {.x_2_1=tint_symbol_4.x_2_1};
+ return tint_symbol_5;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.spvasm
new file mode 100644
index 0000000..4c6f2ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_1 %tint_symbol_3
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %Communicators "Communicators"
+ OpMemberName %Communicators 0 "alice"
+ OpMemberName %Communicators 1 "bob"
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_2_1"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpMemberDecorate %Communicators 0 Offset 0
+ OpMemberDecorate %Communicators 1 Offset 16
+ OpDecorate %tint_symbol Location 9
+ OpDecorate %tint_symbol_1 Location 10
+ OpDecorate %tint_symbol_3 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%Communicators = OpTypeStruct %float %v4float
+%_ptr_Private_Communicators = OpTypePointer Private %Communicators
+ %9 = OpConstantNull %Communicators
+ %x_1 = OpVariable %_ptr_Private_Communicators Private %9
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %12
+%_ptr_Input_float = OpTypePointer Input %float
+%tint_symbol = OpVariable %_ptr_Input_float Input
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%tint_symbol_1 = OpVariable %_ptr_Input_v4float Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %19 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %23 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_Private_float = OpTypePointer Private %float
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %19
+ %22 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_4 = OpFunction %void None %23
+%tint_symbol_2 = OpFunctionParameter %main_out
+ %27 = OpLabel
+ %28 = OpCompositeExtract %v4float %tint_symbol_2 0
+ OpStore %tint_symbol_3 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %19
+ %30 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %35 = OpAccessChain %_ptr_Private_float %x_1 %uint_0
+ %36 = OpLoad %float %tint_symbol
+ OpStore %35 %36
+ %38 = OpAccessChain %_ptr_Private_v4float %x_1 %uint_1
+ %39 = OpLoad %v4float %tint_symbol_1
+ OpStore %38 %39
+ %40 = OpFunctionCall %void %main_1
+ %42 = OpLoad %v4float %x_2
+ %43 = OpCompositeConstruct %main_out %42
+ %41 = OpFunctionCall %void %tint_symbol_4 %43
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.wgsl
new file mode 100644
index 0000000..01cb741
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+struct Communicators {
+ alice : f32;
+ bob : vec4<f32>;
+};
+
+var<private> x_1 : Communicators;
+
+var<private> x_2 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[location(9)]] x_1_param : f32, [[location(10)]] x_1_param_1 : vec4<f32>) -> main_out {
+ x_1.alice = x_1_param;
+ x_1.bob = x_1_param_1;
+ main_1();
+ return main_out(x_2);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm
new file mode 100644
index 0000000..7f8daee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 15
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %position %gl_InstanceIndex
+OpName %position "position"
+OpDecorate %position BuiltIn Position
+OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_InstanceIndex = OpVariable %_ptr_Input_int Input
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%13 = OpLabel
+%14 = OpAccessChain %_ptr_Input_int %gl_InstanceIndex
+%2 = OpLoad %int %14
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..b7ca2fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static int x_4 = 0;
+static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const int x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_InstanceID;
+};
+struct tint_symbol_2 {
+ float4 position_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = asint(x_4_param);
+ main_1();
+ const main_out tint_symbol_3 = {position};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..523de10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_2 {
+ float4 position_1 [[position]];
+};
+
+void main_1(thread int* const tint_symbol_5) {
+ int const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[instance_id]]) {
+ thread int tint_symbol_6 = 0;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = as_type<int>(x_4_param);
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.position_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.position_1=tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..d90a2cd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %position "position"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "position_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn InstanceIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %8 = OpConstantNull %int
+ %x_4 = OpVariable %_ptr_Private_int Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %position = OpVariable %_ptr_Private_v4float Private %12
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %18 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %23 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %18
+ %21 = OpLabel
+ %22 = OpLoad %int %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %23
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %27 = OpLabel
+ %28 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %18
+ %30 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %33 = OpLoad %uint %tint_symbol
+ %32 = OpBitcast %int %33
+ OpStore %x_4 %32
+ %34 = OpFunctionCall %void %main_1
+ %36 = OpLoad %v4float %position
+ %37 = OpCompositeConstruct %main_out %36
+ %35 = OpFunctionCall %void %tint_symbol_3 %37
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..53c8743
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> x_4 : i32;
+
+var<private> position : vec4<f32>;
+
+fn main_1() {
+ let x_2 : i32 = x_4;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ position_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(instance_index)]] x_4_param : u32) -> main_out {
+ x_4 = bitcast<i32>(x_4_param);
+ main_1();
+ return main_out(position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm
new file mode 100644
index 0000000..493046c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 15
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %position %gl_InstanceIndex
+OpName %position "position"
+OpDecorate %position BuiltIn Position
+OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_InstanceIndex = OpVariable %_ptr_Input_int Input
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%13 = OpLabel
+%14 = OpCopyObject %_ptr_Input_int %gl_InstanceIndex
+%2 = OpLoad %int %14
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.hlsl
new file mode 100644
index 0000000..b7ca2fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static int x_4 = 0;
+static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const int x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_InstanceID;
+};
+struct tint_symbol_2 {
+ float4 position_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = asint(x_4_param);
+ main_1();
+ const main_out tint_symbol_3 = {position};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.msl
new file mode 100644
index 0000000..523de10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_2 {
+ float4 position_1 [[position]];
+};
+
+void main_1(thread int* const tint_symbol_5) {
+ int const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[instance_id]]) {
+ thread int tint_symbol_6 = 0;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = as_type<int>(x_4_param);
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.position_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.position_1=tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.spvasm
new file mode 100644
index 0000000..d90a2cd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %position "position"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "position_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn InstanceIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %8 = OpConstantNull %int
+ %x_4 = OpVariable %_ptr_Private_int Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %position = OpVariable %_ptr_Private_v4float Private %12
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %18 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %23 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %18
+ %21 = OpLabel
+ %22 = OpLoad %int %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %23
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %27 = OpLabel
+ %28 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %18
+ %30 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %33 = OpLoad %uint %tint_symbol
+ %32 = OpBitcast %int %33
+ OpStore %x_4 %32
+ %34 = OpFunctionCall %void %main_1
+ %36 = OpLoad %v4float %position
+ %37 = OpCompositeConstruct %main_out %36
+ %35 = OpFunctionCall %void %tint_symbol_3 %37
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.wgsl
new file mode 100644
index 0000000..cfcf7b3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> x_4 : i32;
+
+var<private> position : vec4<f32>;
+
+fn main_1() {
+ let x_14 : ptr<private, i32> = &(x_4);
+ let x_2 : i32 = *(x_14);
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ position_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(instance_index)]] x_4_param : u32) -> main_out {
+ x_4 = bitcast<i32>(x_4_param);
+ main_1();
+ return main_out(position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm
new file mode 100644
index 0000000..c01aa85
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %position %gl_InstanceIndex
+OpName %position "position"
+OpDecorate %position BuiltIn Position
+OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_InstanceIndex = OpVariable %_ptr_Input_int Input
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%13 = OpLabel
+%2 = OpLoad %int %gl_InstanceIndex
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.hlsl
new file mode 100644
index 0000000..b7ca2fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static int x_4 = 0;
+static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const int x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_InstanceID;
+};
+struct tint_symbol_2 {
+ float4 position_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = asint(x_4_param);
+ main_1();
+ const main_out tint_symbol_3 = {position};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.msl
new file mode 100644
index 0000000..523de10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_2 {
+ float4 position_1 [[position]];
+};
+
+void main_1(thread int* const tint_symbol_5) {
+ int const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[instance_id]]) {
+ thread int tint_symbol_6 = 0;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = as_type<int>(x_4_param);
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.position_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.position_1=tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.spvasm
new file mode 100644
index 0000000..d90a2cd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %position "position"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "position_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn InstanceIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %8 = OpConstantNull %int
+ %x_4 = OpVariable %_ptr_Private_int Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %position = OpVariable %_ptr_Private_v4float Private %12
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %18 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %23 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %18
+ %21 = OpLabel
+ %22 = OpLoad %int %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %23
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %27 = OpLabel
+ %28 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %18
+ %30 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %33 = OpLoad %uint %tint_symbol
+ %32 = OpBitcast %int %33
+ OpStore %x_4 %32
+ %34 = OpFunctionCall %void %main_1
+ %36 = OpLoad %v4float %position
+ %37 = OpCompositeConstruct %main_out %36
+ %35 = OpFunctionCall %void %tint_symbol_3 %37
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.wgsl
new file mode 100644
index 0000000..53c8743
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> x_4 : i32;
+
+var<private> position : vec4<f32>;
+
+fn main_1() {
+ let x_2 : i32 = x_4;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ position_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(instance_index)]] x_4_param : u32) -> main_out {
+ x_4 = bitcast<i32>(x_4_param);
+ main_1();
+ return main_out(position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm
new file mode 100644
index 0000000..ada0d60
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 15
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %position %gl_InstanceIndex
+OpName %position "position"
+OpDecorate %position BuiltIn Position
+OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_InstanceIndex = OpVariable %_ptr_Input_uint Input
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%13 = OpLabel
+%14 = OpAccessChain %_ptr_Input_uint %gl_InstanceIndex
+%2 = OpLoad %uint %14
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..5f44758
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint x_4 = 0u;
+static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const uint x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_InstanceID;
+};
+struct tint_symbol_2 {
+ float4 position_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = x_4_param;
+ main_1();
+ const main_out tint_symbol_3 = {position};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..ec253ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_2 {
+ float4 position_1 [[position]];
+};
+
+void main_1(thread uint* const tint_symbol_5) {
+ uint const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[instance_id]]) {
+ thread uint tint_symbol_6 = 0u;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = x_4_param;
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.position_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.position_1=tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..123e58b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %position "position"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "position_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn InstanceIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %8 = OpConstantNull %uint
+ %x_4 = OpVariable %_ptr_Private_uint Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %position = OpVariable %_ptr_Private_v4float Private %12
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %22 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ %21 = OpLoad %uint %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %22
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %26 = OpLabel
+ %27 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %29 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %31 = OpLoad %uint %tint_symbol
+ OpStore %x_4 %31
+ %32 = OpFunctionCall %void %main_1
+ %34 = OpLoad %v4float %position
+ %35 = OpCompositeConstruct %main_out %34
+ %33 = OpFunctionCall %void %tint_symbol_3 %35
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..213cedf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> x_4 : u32;
+
+var<private> position : vec4<f32>;
+
+fn main_1() {
+ let x_2 : u32 = x_4;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ position_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(instance_index)]] x_4_param : u32) -> main_out {
+ x_4 = x_4_param;
+ main_1();
+ return main_out(position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm
new file mode 100644
index 0000000..12195cd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 15
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %position %gl_InstanceIndex
+OpName %position "position"
+OpDecorate %position BuiltIn Position
+OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_InstanceIndex = OpVariable %_ptr_Input_uint Input
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%13 = OpLabel
+%14 = OpCopyObject %_ptr_Input_uint %gl_InstanceIndex
+%2 = OpLoad %uint %14
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.hlsl
new file mode 100644
index 0000000..5f44758
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint x_4 = 0u;
+static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const uint x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_InstanceID;
+};
+struct tint_symbol_2 {
+ float4 position_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = x_4_param;
+ main_1();
+ const main_out tint_symbol_3 = {position};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.msl
new file mode 100644
index 0000000..ec253ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_2 {
+ float4 position_1 [[position]];
+};
+
+void main_1(thread uint* const tint_symbol_5) {
+ uint const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[instance_id]]) {
+ thread uint tint_symbol_6 = 0u;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = x_4_param;
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.position_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.position_1=tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.spvasm
new file mode 100644
index 0000000..123e58b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %position "position"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "position_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn InstanceIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %8 = OpConstantNull %uint
+ %x_4 = OpVariable %_ptr_Private_uint Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %position = OpVariable %_ptr_Private_v4float Private %12
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %22 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ %21 = OpLoad %uint %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %22
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %26 = OpLabel
+ %27 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %29 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %31 = OpLoad %uint %tint_symbol
+ OpStore %x_4 %31
+ %32 = OpFunctionCall %void %main_1
+ %34 = OpLoad %v4float %position
+ %35 = OpCompositeConstruct %main_out %34
+ %33 = OpFunctionCall %void %tint_symbol_3 %35
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.wgsl
new file mode 100644
index 0000000..4318882
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> x_4 : u32;
+
+var<private> position : vec4<f32>;
+
+fn main_1() {
+ let x_14 : ptr<private, u32> = &(x_4);
+ let x_2 : u32 = *(x_14);
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ position_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(instance_index)]] x_4_param : u32) -> main_out {
+ x_4 = x_4_param;
+ main_1();
+ return main_out(position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm
new file mode 100644
index 0000000..873e6ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %position %gl_InstanceIndex
+OpName %position "position"
+OpDecorate %position BuiltIn Position
+OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_InstanceIndex = OpVariable %_ptr_Input_uint Input
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%13 = OpLabel
+%2 = OpLoad %uint %gl_InstanceIndex
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.hlsl
new file mode 100644
index 0000000..5f44758
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint x_4 = 0u;
+static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const uint x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_InstanceID;
+};
+struct tint_symbol_2 {
+ float4 position_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = x_4_param;
+ main_1();
+ const main_out tint_symbol_3 = {position};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.msl
new file mode 100644
index 0000000..ec253ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 position_1;
+};
+struct tint_symbol_2 {
+ float4 position_1 [[position]];
+};
+
+void main_1(thread uint* const tint_symbol_5) {
+ uint const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[instance_id]]) {
+ thread uint tint_symbol_6 = 0u;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = x_4_param;
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.position_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.position_1=tint_symbol_3.position_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.spvasm
new file mode 100644
index 0000000..123e58b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %position "position"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "position_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn InstanceIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %8 = OpConstantNull %uint
+ %x_4 = OpVariable %_ptr_Private_uint Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %position = OpVariable %_ptr_Private_v4float Private %12
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %22 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ %21 = OpLoad %uint %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %22
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %26 = OpLabel
+ %27 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %29 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %31 = OpLoad %uint %tint_symbol
+ OpStore %x_4 %31
+ %32 = OpFunctionCall %void %main_1
+ %34 = OpLoad %v4float %position
+ %35 = OpCompositeConstruct %main_out %34
+ %33 = OpFunctionCall %void %tint_symbol_3 %35
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.wgsl
new file mode 100644
index 0000000..213cedf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> x_4 : u32;
+
+var<private> position : vec4<f32>;
+
+fn main_1() {
+ let x_2 : u32 = x_4;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ position_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(instance_index)]] x_4_param : u32) -> main_out {
+ x_4 = x_4_param;
+ main_1();
+ return main_out(position);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm
new file mode 100644
index 0000000..2d749c1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvModuleScopeVarParserTest_MatrixInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%31 = OpConstantComposite %v2float %float_1_5 %float_2
+%32 = OpConstantComposite %v2float %float_2 %float_3
+%33 = OpConstantComposite %v2float %float_3 %float_4
+%34 = OpConstantComposite %mat3v2float %31 %32 %33
+%200 = OpVariable %_ptr_Private_mat3v2float Private %34
+%1 = OpFunction %void None %3
+%35 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..9b65d1f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static float3x2 x_200 = float3x2(float2(1.5f, 2.0f), float2(2.0f, 3.0f), float2(3.0f, 4.0f));
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..34d28df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+ %float_1_5 = OpConstant %float 1.5
+ %float_2 = OpConstant %float 2
+ %6 = OpConstantComposite %v2float %float_1_5 %float_2
+ %float_3 = OpConstant %float 3
+ %8 = OpConstantComposite %v2float %float_2 %float_3
+ %float_4 = OpConstant %float 4
+ %10 = OpConstantComposite %v2float %float_3 %float_4
+ %11 = OpConstantComposite %mat3v2float %6 %8 %10
+%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
+ %x_200 = OpVariable %_ptr_Private_mat3v2float Private %11
+ %void = OpTypeVoid
+ %14 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %14
+ %17 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %14
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..1d137c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_200 : mat3x2<f32> = mat3x2<f32>(vec2<f32>(1.5, 2.0), vec2<f32>(2.0, 3.0), vec2<f32>(3.0, 4.0));
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm
new file mode 100644
index 0000000..0f45856
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm
@@ -0,0 +1,43 @@
+; Test: SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
+%28 = OpConstantNull %mat3v2float
+%200 = OpVariable %_ptr_Private_mat3v2float Private %28
+%1 = OpFunction %void None %3
+%29 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..89e1fde
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static float3x2 x_200 = float3x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..afc1b9f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+ %float_0 = OpConstant %float 0
+ %5 = OpConstantComposite %v2float %float_0 %float_0
+ %6 = OpConstantComposite %mat3v2float %5 %5 %5
+%_ptr_Private_mat3v2float = OpTypePointer Private %mat3v2float
+ %x_200 = OpVariable %_ptr_Private_mat3v2float Private %6
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..bc1e84b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_200 : mat3x2<f32> = mat3x2<f32>(vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0));
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm
new file mode 100644
index 0000000..ea9f6c5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 11
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %myvar "myvar"
+OpDecorate %myvar DescriptorSet 0
+OpDecorate %myvar Binding 0
+OpDecorate %_struct_3 Block
+OpMemberDecorate %_struct_3 0 MatrixStride 8
+OpMemberDecorate %_struct_3 0 Offset 0
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%_struct_3 = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3
+%myvar = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
+%1 = OpFunction %void None %5
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.hlsl
new file mode 100644
index 0000000..ef0855d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+RWByteAddressBuffer myvar : register(u0, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.msl
new file mode 100644
index 0000000..ecdf927
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ /* 0x0000 */ float3x2 field0;
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.spvasm
new file mode 100644
index 0000000..64446e5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 0 ColMajor
+ OpMemberDecorate %S 0 MatrixStride 8
+ OpDecorate %myvar DescriptorSet 0
+ OpDecorate %myvar Binding 0
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+ %S = OpTypeStruct %mat3v2float
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %myvar = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.wgsl
new file mode 100644
index 0000000..79b8f48
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+[[block]]
+struct S {
+ field0 : mat3x2<f32>;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm
new file mode 100644
index 0000000..b4be368
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 53
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %the_counter "the_counter"
+%float = OpTypeFloat 32
+%_ptr_Workgroup_float = OpTypePointer Workgroup %float
+%the_counter = OpVariable %_ptr_Workgroup_float Workgroup
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.hlsl
new file mode 100644
index 0000000..2ce495e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+groupshared float the_counter;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.spvasm
new file mode 100644
index 0000000..20f308b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %the_counter "the_counter"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %float = OpTypeFloat 32
+%_ptr_Workgroup_float = OpTypePointer Workgroup %float
+%the_counter = OpVariable %_ptr_Workgroup_float Workgroup
+ %void = OpTypeVoid
+ %4 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %4
+ %7 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %4
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.wgsl
new file mode 100644
index 0000000..1ab5fb5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<workgroup> the_counter : f32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm
new file mode 100644
index 0000000..57d2697
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm
@@ -0,0 +1,40 @@
+; Test: SpvModuleScopeVarParserTest_NoVar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 28
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%1 = OpFunction %void None %3
+%27 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.hlsl
new file mode 100644
index 0000000..1135368
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.spvasm
new file mode 100644
index 0000000..ca944f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.wgsl
new file mode 100644
index 0000000..471e2a6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm
new file mode 100644
index 0000000..f0d1d72
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm
@@ -0,0 +1,42 @@
+; Test: SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 30
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Output_uint = OpTypePointer Output %uint
+%1 = OpVariable %_ptr_Output_uint Output
+%2 = OpFunction %void None %4
+%29 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.hlsl
new file mode 100644
index 0000000..415c810
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint x_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.spvasm
new file mode 100644
index 0000000..de87216
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.wgsl
new file mode 100644
index 0000000..21b73b3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm
new file mode 100644
index 0000000..4aecc89
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm
@@ -0,0 +1,42 @@
+; Test: SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 30
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Output_uint = OpTypePointer Output %uint
+%1 = OpVariable %_ptr_Output_uint Output %uint_1
+%2 = OpFunction %void None %4
+%29 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..d9b85b3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint x_1 = 1u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..ced9f15
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %uint_1
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..146796b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_1 : u32 = 1u;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm
new file mode 100644
index 0000000..b50504d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 16
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %1 %gl_Position
+OpDecorate %1 Location 4
+OpDecorate %gl_Position BuiltIn Position
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_3 = OpConstant %uint 3
+%_arr_float_uint_3 = OpTypeArray %float %uint_3
+%_ptr_Output__arr_float_uint_3 = OpTypePointer Output %_arr_float_uint_3
+%1 = OpVariable %_ptr_Output__arr_float_uint_3 Output
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %5
+%15 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.hlsl
new file mode 100644
index 0000000..0d3cc17
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static float x_1[3] = (float[3])0;
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float x_1_1;
+ float x_1_2;
+ float x_1_3;
+ float4 x_2_1;
+};
+struct tint_symbol {
+ float x_1_1 : TEXCOORD4;
+ float x_1_2 : TEXCOORD5;
+ float x_1_3 : TEXCOORD6;
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_1[0], x_1[1], x_1[2], x_2};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1, tint_symbol_1.x_1_2, tint_symbol_1.x_1_3, tint_symbol_1.x_2_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.msl
new file mode 100644
index 0000000..c00c75e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.msl
@@ -0,0 +1,32 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ float arr[3];
+};
+struct main_out {
+ float x_1_1;
+ float x_1_2;
+ float x_1_3;
+ float4 x_2_1;
+};
+struct tint_symbol_1 {
+ float x_1_1 [[user(locn4)]];
+ float x_1_2 [[user(locn5)]];
+ float x_1_3 [[user(locn6)]];
+ float4 x_2_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread tint_array_wrapper tint_symbol_4 = {};
+ thread float4 tint_symbol_5 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.x_1_1=tint_symbol_4.arr[0], .x_1_2=tint_symbol_4.arr[1], .x_1_3=tint_symbol_4.arr[2], .x_2_1=tint_symbol_5};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1, .x_1_2=tint_symbol_2.x_1_2, .x_1_3=tint_symbol_2.x_1_3, .x_2_1=tint_symbol_2.x_2_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.spvasm
new file mode 100644
index 0000000..6ce7ccc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.spvasm
@@ -0,0 +1,95 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1 %tint_symbol_2 %tint_symbol_3 %tint_symbol_4
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpMemberName %main_out 1 "x_1_2"
+ OpMemberName %main_out 2 "x_1_3"
+ OpMemberName %main_out 3 "x_2_1"
+ OpName %tint_symbol_5 "tint_symbol_5"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %_arr_float_uint_3 ArrayStride 4
+ OpDecorate %tint_symbol_1 Location 4
+ OpDecorate %tint_symbol_2 Location 5
+ OpDecorate %tint_symbol_3 Location 6
+ OpDecorate %tint_symbol_4 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ OpMemberDecorate %main_out 1 Offset 4
+ OpMemberDecorate %main_out 2 Offset 8
+ OpMemberDecorate %main_out 3 Offset 16
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+ %uint_3 = OpConstant %uint 3
+%_arr_float_uint_3 = OpTypeArray %float %uint_3
+%_ptr_Private__arr_float_uint_3 = OpTypePointer Private %_arr_float_uint_3
+ %10 = OpConstantNull %_arr_float_uint_3
+ %x_1 = OpVariable %_ptr_Private__arr_float_uint_3 Private %10
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %14 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %14
+%tint_symbol_1 = OpVariable %_ptr_Output_float Output %4
+%tint_symbol_2 = OpVariable %_ptr_Output_float Output %4
+%tint_symbol_3 = OpVariable %_ptr_Output_float Output %4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_4 = OpVariable %_ptr_Output_v4float Output %14
+ %void = OpTypeVoid
+ %20 = OpTypeFunction %void
+ %main_out = OpTypeStruct %float %float %float %v4float
+ %24 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_float = OpTypePointer Private %float
+ %int_1 = OpConstant %int 1
+ %int_2 = OpConstant %int 2
+ %main_1 = OpFunction %void None %20
+ %23 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_5 = OpFunction %void None %24
+%tint_symbol = OpFunctionParameter %main_out
+ %28 = OpLabel
+ %29 = OpCompositeExtract %float %tint_symbol 0
+ OpStore %tint_symbol_1 %29
+ %30 = OpCompositeExtract %float %tint_symbol 1
+ OpStore %tint_symbol_2 %30
+ %31 = OpCompositeExtract %float %tint_symbol 2
+ OpStore %tint_symbol_3 %31
+ %32 = OpCompositeExtract %v4float %tint_symbol 3
+ OpStore %tint_symbol_4 %32
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %20
+ %34 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %36 = OpFunctionCall %void %main_1
+ %41 = OpAccessChain %_ptr_Private_float %x_1 %int_0
+ %42 = OpLoad %float %41
+ %44 = OpAccessChain %_ptr_Private_float %x_1 %int_1
+ %45 = OpLoad %float %44
+ %47 = OpAccessChain %_ptr_Private_float %x_1 %int_2
+ %48 = OpLoad %float %47
+ %49 = OpLoad %v4float %x_2
+ %50 = OpCompositeConstruct %main_out %42 %45 %48 %49
+ %37 = OpFunctionCall %void %tint_symbol_5 %50
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.wgsl
new file mode 100644
index 0000000..eafdb67
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+var<private> x_1 : array<f32, 3>;
+
+var<private> x_2 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[location(4)]]
+ x_1_1 : f32;
+ [[location(5)]]
+ x_1_2 : f32;
+ [[location(6)]]
+ x_1_3 : f32;
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_1[0], x_1[1], x_1[2], x_2);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm
new file mode 100644
index 0000000..87a8dc9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm
@@ -0,0 +1,26 @@
+; Test: SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %1 %gl_Position
+OpDecorate %1 Location 9
+OpDecorate %gl_Position BuiltIn Position
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%mat2v4float = OpTypeMatrix %v4float 2
+%uint = OpTypeInt 32 0
+%_ptr_Output_mat2v4float = OpTypePointer Output %mat2v4float
+%1 = OpVariable %_ptr_Output_mat2v4float Output
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %5
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.hlsl
new file mode 100644
index 0000000..41ab4a7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+static float2x4 x_1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 x_1_1;
+ float4 x_1_2;
+ float4 x_2_1;
+};
+struct tint_symbol {
+ float4 x_1_1 : TEXCOORD9;
+ float4 x_1_2 : TEXCOORD10;
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_1[0], x_1[1], x_2};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1, tint_symbol_1.x_1_2, tint_symbol_1.x_2_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.msl
new file mode 100644
index 0000000..794f327
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_1_1;
+ float4 x_1_2;
+ float4 x_2_1;
+};
+struct tint_symbol_1 {
+ float4 x_1_1 [[user(locn9)]];
+ float4 x_1_2 [[user(locn10)]];
+ float4 x_2_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float2x4 tint_symbol_4 = float2x4(0.0f);
+ thread float4 tint_symbol_5 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.x_1_1=tint_symbol_4[0], .x_1_2=tint_symbol_4[1], .x_2_1=tint_symbol_5};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1, .x_1_2=tint_symbol_2.x_1_2, .x_2_1=tint_symbol_2.x_2_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.spvasm
new file mode 100644
index 0000000..4c93fec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1 %tint_symbol_2 %tint_symbol_3
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpMemberName %main_out 1 "x_1_2"
+ OpMemberName %main_out 2 "x_2_1"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 Location 9
+ OpDecorate %tint_symbol_2 Location 10
+ OpDecorate %tint_symbol_3 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ OpMemberDecorate %main_out 1 Offset 16
+ OpMemberDecorate %main_out 2 Offset 32
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%mat2v4float = OpTypeMatrix %v4float 2
+%_ptr_Private_mat2v4float = OpTypePointer Private %mat2v4float
+ %9 = OpConstantNull %mat2v4float
+ %x_1 = OpVariable %_ptr_Private_mat2v4float Private %9
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %12
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float %v4float %v4float
+ %21 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+ %int_1 = OpConstant %int 1
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_4 = OpFunction %void None %21
+%tint_symbol = OpFunctionParameter %main_out
+ %25 = OpLabel
+ %26 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %26
+ %27 = OpCompositeExtract %v4float %tint_symbol 1
+ OpStore %tint_symbol_2 %27
+ %28 = OpCompositeExtract %v4float %tint_symbol 2
+ OpStore %tint_symbol_3 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %30 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %32 = OpFunctionCall %void %main_1
+ %36 = OpAccessChain %_ptr_Private_v4float %x_1 %int_0
+ %37 = OpLoad %v4float %36
+ %39 = OpAccessChain %_ptr_Private_v4float %x_1 %int_1
+ %40 = OpLoad %v4float %39
+ %41 = OpLoad %v4float %x_2
+ %42 = OpCompositeConstruct %main_out %37 %40 %41
+ %33 = OpFunctionCall %void %tint_symbol_4 %42
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.wgsl
new file mode 100644
index 0000000..4bd102d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+var<private> x_1 : mat2x4<f32>;
+
+var<private> x_2 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[location(9)]]
+ x_1_1 : vec4<f32>;
+ [[location(10)]]
+ x_1_2 : vec4<f32>;
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_1[0], x_1[1], x_2);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm
new file mode 100644
index 0000000..6da3c09
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %1 %gl_Position
+OpName %Communicators "Communicators"
+OpMemberName %Communicators 0 "alice"
+OpMemberName %Communicators 1 "bob"
+OpDecorate %1 Location 9
+OpDecorate %gl_Position BuiltIn Position
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%Communicators = OpTypeStruct %float %v4float
+%_ptr_Output_Communicators = OpTypePointer Output %Communicators
+%1 = OpVariable %_ptr_Output_Communicators Output
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%9 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.hlsl
new file mode 100644
index 0000000..2efd4a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+struct Communicators {
+ float alice;
+ float4 bob;
+};
+
+static Communicators x_1 = (Communicators)0;
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float x_1_1;
+ float4 x_1_2;
+ float4 x_2_1;
+};
+struct tint_symbol {
+ float x_1_1 : TEXCOORD9;
+ float4 x_1_2 : TEXCOORD10;
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_1.alice, x_1.bob, x_2};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1, tint_symbol_1.x_1_2, tint_symbol_1.x_2_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.msl
new file mode 100644
index 0000000..3ecb5da
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.msl
@@ -0,0 +1,31 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct Communicators {
+ float alice;
+ float4 bob;
+};
+struct main_out {
+ float x_1_1;
+ float4 x_1_2;
+ float4 x_2_1;
+};
+struct tint_symbol_1 {
+ float x_1_1 [[user(locn9)]];
+ float4 x_1_2 [[user(locn10)]];
+ float4 x_2_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread Communicators tint_symbol_4 = {};
+ thread float4 tint_symbol_5 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.x_1_1=tint_symbol_4.alice, .x_1_2=tint_symbol_4.bob, .x_2_1=tint_symbol_5};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1, .x_1_2=tint_symbol_2.x_1_2, .x_2_1=tint_symbol_2.x_2_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.spvasm
new file mode 100644
index 0000000..0d54b93
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1 %tint_symbol_2 %tint_symbol_3
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %Communicators "Communicators"
+ OpMemberName %Communicators 0 "alice"
+ OpMemberName %Communicators 1 "bob"
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpMemberName %main_out 1 "x_1_2"
+ OpMemberName %main_out 2 "x_2_1"
+ OpName %tint_symbol_4 "tint_symbol_4"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpMemberDecorate %Communicators 0 Offset 0
+ OpMemberDecorate %Communicators 1 Offset 16
+ OpDecorate %tint_symbol_1 Location 9
+ OpDecorate %tint_symbol_2 Location 10
+ OpDecorate %tint_symbol_3 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ OpMemberDecorate %main_out 1 Offset 16
+ OpMemberDecorate %main_out 2 Offset 32
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%Communicators = OpTypeStruct %float %v4float
+%_ptr_Private_Communicators = OpTypePointer Private %Communicators
+ %9 = OpConstantNull %Communicators
+ %x_1 = OpVariable %_ptr_Private_Communicators Private %9
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %12
+%tint_symbol_1 = OpVariable %_ptr_Output_float Output %4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_out = OpTypeStruct %float %v4float %v4float
+ %21 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_Private_float = OpTypePointer Private %float
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_4 = OpFunction %void None %21
+%tint_symbol = OpFunctionParameter %main_out
+ %25 = OpLabel
+ %26 = OpCompositeExtract %float %tint_symbol 0
+ OpStore %tint_symbol_1 %26
+ %27 = OpCompositeExtract %v4float %tint_symbol 1
+ OpStore %tint_symbol_2 %27
+ %28 = OpCompositeExtract %v4float %tint_symbol 2
+ OpStore %tint_symbol_3 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %30 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %32 = OpFunctionCall %void %main_1
+ %37 = OpAccessChain %_ptr_Private_float %x_1 %uint_0
+ %38 = OpLoad %float %37
+ %40 = OpAccessChain %_ptr_Private_v4float %x_1 %uint_1
+ %41 = OpLoad %v4float %40
+ %42 = OpLoad %v4float %x_2
+ %43 = OpCompositeConstruct %main_out %38 %41 %42
+ %33 = OpFunctionCall %void %tint_symbol_4 %43
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.wgsl
new file mode 100644
index 0000000..3283c58
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.wgsl
@@ -0,0 +1,27 @@
+struct Communicators {
+ alice : f32;
+ bob : vec4<f32>;
+};
+
+var<private> x_1 : Communicators;
+
+var<private> x_2 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[location(9)]]
+ x_1_1 : f32;
+ [[location(10)]]
+ x_1_2 : vec4<f32>;
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_1.alice, x_1.bob, x_2);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm
new file mode 100644
index 0000000..7f40308
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvModuleScopeVarParserTest_PrivateVar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 53
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %my_own_private_idaho "my_own_private_idaho"
+%float = OpTypeFloat 32
+%_ptr_Private_float = OpTypePointer Private %float
+%my_own_private_idaho = OpVariable %_ptr_Private_float Private
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.hlsl
new file mode 100644
index 0000000..76182bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static float my_own_private_idaho = 0.0f;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.spvasm
new file mode 100644
index 0000000..458710e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %my_own_private_idaho "my_own_private_idaho"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %float = OpTypeFloat 32
+%_ptr_Private_float = OpTypePointer Private %float
+ %4 = OpConstantNull %float
+%my_own_private_idaho = OpVariable %_ptr_Private_float Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.wgsl
new file mode 100644
index 0000000..46b790f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> my_own_private_idaho : f32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm
new file mode 100644
index 0000000..03b178d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm
@@ -0,0 +1,26 @@
+; Test: SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 12
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %3 "main" %gl_SampleID
+OpExecutionMode %3 OriginUpperLeft
+OpDecorate %gl_SampleID BuiltIn SampleId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_SampleID = OpVariable %_ptr_Input_int Input
+%3 = OpFunction %void None %5
+%10 = OpLabel
+%11 = OpAccessChain %_ptr_Input_int %gl_SampleID
+%2 = OpLoad %int %11
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..702cebb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static int x_1 = 0;
+
+void main_1() {
+ const int x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_SampleIndex;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..5abadcb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int* const tint_symbol_2) {
+ int const x_2 = *(tint_symbol_2);
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_id]]) {
+ thread int tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..2cc5536
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampleRateShading
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn SampleId
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %4 = OpConstantNull %int
+ %x_1 = OpVariable %_ptr_Private_int Private %4
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %16 = OpLoad %uint %tint_symbol
+ %15 = OpBitcast %int %16
+ OpStore %x_1 %15
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..5035555
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : i32;
+
+fn main_1() {
+ let x_2 : i32 = x_1;
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_index)]] x_1_param : u32) {
+ x_1 = bitcast<i32>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm
new file mode 100644
index 0000000..8f56732
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm
@@ -0,0 +1,26 @@
+; Test: SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 12
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %3 "main" %gl_SampleID
+OpExecutionMode %3 OriginUpperLeft
+OpDecorate %gl_SampleID BuiltIn SampleId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_SampleID = OpVariable %_ptr_Input_int Input
+%3 = OpFunction %void None %5
+%10 = OpLabel
+%11 = OpCopyObject %_ptr_Input_int %gl_SampleID
+%2 = OpLoad %int %11
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.hlsl
new file mode 100644
index 0000000..702cebb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static int x_1 = 0;
+
+void main_1() {
+ const int x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_SampleIndex;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.msl
new file mode 100644
index 0000000..5abadcb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int* const tint_symbol_2) {
+ int const x_2 = *(tint_symbol_2);
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_id]]) {
+ thread int tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.spvasm
new file mode 100644
index 0000000..2cc5536
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampleRateShading
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn SampleId
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %4 = OpConstantNull %int
+ %x_1 = OpVariable %_ptr_Private_int Private %4
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %16 = OpLoad %uint %tint_symbol
+ %15 = OpBitcast %int %16
+ OpStore %x_1 %15
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.wgsl
new file mode 100644
index 0000000..cc8821e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> x_1 : i32;
+
+fn main_1() {
+ let x_11 : ptr<private, i32> = &(x_1);
+ let x_2 : i32 = *(x_11);
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_index)]] x_1_param : u32) {
+ x_1 = bitcast<i32>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm
new file mode 100644
index 0000000..e723d72
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm
@@ -0,0 +1,25 @@
+; Test: SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 11
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %3 "main" %gl_SampleID
+OpExecutionMode %3 OriginUpperLeft
+OpDecorate %gl_SampleID BuiltIn SampleId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_SampleID = OpVariable %_ptr_Input_int Input
+%3 = OpFunction %void None %5
+%10 = OpLabel
+%2 = OpLoad %int %gl_SampleID
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.hlsl
new file mode 100644
index 0000000..702cebb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static int x_1 = 0;
+
+void main_1() {
+ const int x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_SampleIndex;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.msl
new file mode 100644
index 0000000..5abadcb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread int* const tint_symbol_2) {
+ int const x_2 = *(tint_symbol_2);
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_id]]) {
+ thread int tint_symbol_3 = 0;
+ tint_symbol_3 = as_type<int>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.spvasm
new file mode 100644
index 0000000..2cc5536
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampleRateShading
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn SampleId
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %4 = OpConstantNull %int
+ %x_1 = OpVariable %_ptr_Private_int Private %4
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpLoad %int %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %14 = OpLabel
+ %16 = OpLoad %uint %tint_symbol
+ %15 = OpBitcast %int %16
+ OpStore %x_1 %15
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.wgsl
new file mode 100644
index 0000000..5035555
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : i32;
+
+fn main_1() {
+ let x_2 : i32 = x_1;
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_index)]] x_1_param : u32) {
+ x_1 = bitcast<i32>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm
new file mode 100644
index 0000000..ccfb3d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm
@@ -0,0 +1,26 @@
+; Test: SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 12
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %3 "main" %gl_SampleID
+OpExecutionMode %3 OriginUpperLeft
+OpDecorate %gl_SampleID BuiltIn SampleId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_SampleID = OpVariable %_ptr_Input_uint Input
+%3 = OpFunction %void None %5
+%10 = OpLabel
+%11 = OpAccessChain %_ptr_Input_uint %gl_SampleID
+%2 = OpLoad %uint %11
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..a7810ba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint x_1 = 0u;
+
+void main_1() {
+ const uint x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_SampleIndex;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..68116a9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_2) {
+ uint const x_2 = *(tint_symbol_2);
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_id]]) {
+ thread uint tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..82c6620
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampleRateShading
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn SampleId
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ %11 = OpLoad %uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %13 = OpLabel
+ %14 = OpLoad %uint %tint_symbol
+ OpStore %x_1 %14
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..9b4cf72
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : u32;
+
+fn main_1() {
+ let x_2 : u32 = x_1;
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_index)]] x_1_param : u32) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm
new file mode 100644
index 0000000..96f57aa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm
@@ -0,0 +1,26 @@
+; Test: SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 12
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %3 "main" %gl_SampleID
+OpExecutionMode %3 OriginUpperLeft
+OpDecorate %gl_SampleID BuiltIn SampleId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_SampleID = OpVariable %_ptr_Input_uint Input
+%3 = OpFunction %void None %5
+%10 = OpLabel
+%11 = OpCopyObject %_ptr_Input_uint %gl_SampleID
+%2 = OpLoad %uint %11
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.hlsl
new file mode 100644
index 0000000..a7810ba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint x_1 = 0u;
+
+void main_1() {
+ const uint x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_SampleIndex;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.msl
new file mode 100644
index 0000000..68116a9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_2) {
+ uint const x_2 = *(tint_symbol_2);
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_id]]) {
+ thread uint tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.spvasm
new file mode 100644
index 0000000..82c6620
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampleRateShading
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn SampleId
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ %11 = OpLoad %uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %13 = OpLabel
+ %14 = OpLoad %uint %tint_symbol
+ OpStore %x_1 %14
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.wgsl
new file mode 100644
index 0000000..bbfa55e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> x_1 : u32;
+
+fn main_1() {
+ let x_11 : ptr<private, u32> = &(x_1);
+ let x_2 : u32 = *(x_11);
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_index)]] x_1_param : u32) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm
new file mode 100644
index 0000000..df67299
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm
@@ -0,0 +1,25 @@
+; Test: SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 11
+; Schema: 0
+OpCapability Shader
+OpCapability SampleRateShading
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %3 "main" %gl_SampleID
+OpExecutionMode %3 OriginUpperLeft
+OpDecorate %gl_SampleID BuiltIn SampleId
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_SampleID = OpVariable %_ptr_Input_uint Input
+%3 = OpFunction %void None %5
+%10 = OpLabel
+%2 = OpLoad %uint %gl_SampleID
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.hlsl
new file mode 100644
index 0000000..a7810ba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint x_1 = 0u;
+
+void main_1() {
+ const uint x_2 = x_1;
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_SampleIndex;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1 = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.msl
new file mode 100644
index 0000000..68116a9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_2) {
+ uint const x_2 = *(tint_symbol_2);
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_id]]) {
+ thread uint tint_symbol_3 = 0u;
+ tint_symbol_3 = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.spvasm
new file mode 100644
index 0000000..82c6620
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampleRateShading
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %tint_symbol BuiltIn SampleId
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ %11 = OpLoad %uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %13 = OpLabel
+ %14 = OpLoad %uint %tint_symbol
+ OpStore %x_1 %14
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.wgsl
new file mode 100644
index 0000000..9b4cf72
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : u32;
+
+fn main_1() {
+ let x_2 : u32 = x_1;
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_index)]] x_1_param : u32) {
+ x_1 = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm
new file mode 100644
index 0000000..de592f9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 26
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %5 "main" %gl_SampleMask
+OpExecutionMode %5 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_int_uint_1 = OpTypePointer Input %_arr_int_uint_1
+%_ptr_Output__arr_int_uint_1 = OpTypePointer Output %_arr_int_uint_1
+%gl_SampleMask = OpVariable %_ptr_Input__arr_int_uint_1 Input
+%5 = OpFunction %void None %7
+%25 = OpLabel
+%2 = OpAccessChain %_ptr_Input_int %gl_SampleMask %uint_0
+%3 = OpAccessChain %_ptr_Input_int %2
+%4 = OpLoad %int %3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..69c22b5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static int x_1[1] = (int[1])0;
+
+void main_1() {
+ const int x_4 = x_1[0];
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_Coverage;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1[0] = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..b408ffe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ int arr[1];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_2) {
+ int const x_4 = (*(tint_symbol_2)).arr[0];
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_mask]]) {
+ thread tint_array_wrapper tint_symbol_3 = {};
+ tint_symbol_3.arr[0] = as_type<int>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..50e0611
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.spvasm
@@ -0,0 +1,47 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 27
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_int_uint_1 ArrayStride 4
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol BuiltIn SampleMask
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_ptr_Private__arr_int_uint_1 = OpTypePointer Private %_arr_int_uint_1
+ %7 = OpConstantNull %_arr_int_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_int_uint_1 Private %7
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%tint_symbol = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %int_0 = OpConstant %int 0
+%_ptr_Private_int = OpTypePointer Private %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ %17 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ %18 = OpLoad %int %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %20 = OpLabel
+ %21 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ %24 = OpAccessChain %_ptr_Input_uint %tint_symbol %int_0
+ %25 = OpLoad %uint %24
+ %22 = OpBitcast %int %25
+ OpStore %21 %22
+ %26 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..8e340b1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : array<i32, 1>;
+
+fn main_1() {
+ let x_4 : i32 = x_1[0];
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_mask)]] x_1_param : u32) {
+ x_1[0] = bitcast<i32>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm
new file mode 100644
index 0000000..432b5d9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 26
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %5 "main" %gl_SampleMask
+OpExecutionMode %5 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_int_uint_1 = OpTypePointer Input %_arr_int_uint_1
+%_ptr_Output__arr_int_uint_1 = OpTypePointer Output %_arr_int_uint_1
+%gl_SampleMask = OpVariable %_ptr_Input__arr_int_uint_1 Input
+%5 = OpFunction %void None %7
+%25 = OpLabel
+%2 = OpAccessChain %_ptr_Input_int %gl_SampleMask %uint_0
+%3 = OpCopyObject %_ptr_Input_int %2
+%4 = OpLoad %int %3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.hlsl
new file mode 100644
index 0000000..69c22b5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static int x_1[1] = (int[1])0;
+
+void main_1() {
+ const int x_4 = x_1[0];
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_Coverage;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1[0] = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.msl
new file mode 100644
index 0000000..b408ffe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ int arr[1];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_2) {
+ int const x_4 = (*(tint_symbol_2)).arr[0];
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_mask]]) {
+ thread tint_array_wrapper tint_symbol_3 = {};
+ tint_symbol_3.arr[0] = as_type<int>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.spvasm
new file mode 100644
index 0000000..50e0611
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.spvasm
@@ -0,0 +1,47 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 27
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_int_uint_1 ArrayStride 4
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol BuiltIn SampleMask
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_ptr_Private__arr_int_uint_1 = OpTypePointer Private %_arr_int_uint_1
+ %7 = OpConstantNull %_arr_int_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_int_uint_1 Private %7
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%tint_symbol = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %int_0 = OpConstant %int 0
+%_ptr_Private_int = OpTypePointer Private %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ %17 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ %18 = OpLoad %int %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %20 = OpLabel
+ %21 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ %24 = OpAccessChain %_ptr_Input_uint %tint_symbol %int_0
+ %25 = OpLoad %uint %24
+ %22 = OpBitcast %int %25
+ OpStore %21 %22
+ %26 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.wgsl
new file mode 100644
index 0000000..8e340b1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : array<i32, 1>;
+
+fn main_1() {
+ let x_4 : i32 = x_1[0];
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_mask)]] x_1_param : u32) {
+ x_1[0] = bitcast<i32>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm
new file mode 100644
index 0000000..ecec88b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm
@@ -0,0 +1,38 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 25
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %4 "main" %gl_SampleMask
+OpExecutionMode %4 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_int_uint_1 = OpTypePointer Input %_arr_int_uint_1
+%_ptr_Output__arr_int_uint_1 = OpTypePointer Output %_arr_int_uint_1
+%gl_SampleMask = OpVariable %_ptr_Input__arr_int_uint_1 Input
+%4 = OpFunction %void None %6
+%24 = OpLabel
+%2 = OpAccessChain %_ptr_Input_int %gl_SampleMask %uint_0
+%3 = OpLoad %int %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.hlsl
new file mode 100644
index 0000000..8d551f5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static int x_1[1] = (int[1])0;
+
+void main_1() {
+ const int x_3 = x_1[0];
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_Coverage;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1[0] = asint(x_1_param);
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.msl
new file mode 100644
index 0000000..5ec09f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ int arr[1];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_2) {
+ int const x_3 = (*(tint_symbol_2)).arr[0];
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_mask]]) {
+ thread tint_array_wrapper tint_symbol_3 = {};
+ tint_symbol_3.arr[0] = as_type<int>(x_1_param);
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.spvasm
new file mode 100644
index 0000000..50e0611
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.spvasm
@@ -0,0 +1,47 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 27
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_int_uint_1 ArrayStride 4
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol BuiltIn SampleMask
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_ptr_Private__arr_int_uint_1 = OpTypePointer Private %_arr_int_uint_1
+ %7 = OpConstantNull %_arr_int_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_int_uint_1 Private %7
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%tint_symbol = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %int_0 = OpConstant %int 0
+%_ptr_Private_int = OpTypePointer Private %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ %17 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ %18 = OpLoad %int %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %20 = OpLabel
+ %21 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ %24 = OpAccessChain %_ptr_Input_uint %tint_symbol %int_0
+ %25 = OpLoad %uint %24
+ %22 = OpBitcast %int %25
+ OpStore %21 %22
+ %26 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.wgsl
new file mode 100644
index 0000000..95ed8a7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : array<i32, 1>;
+
+fn main_1() {
+ let x_3 : i32 = x_1[0];
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_mask)]] x_1_param : u32) {
+ x_1[0] = bitcast<i32>(x_1_param);
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm
new file mode 100644
index 0000000..ecbb7c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 26
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %5 "main" %gl_SampleMask
+OpExecutionMode %5 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%gl_SampleMask = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+%5 = OpFunction %void None %7
+%25 = OpLabel
+%2 = OpAccessChain %_ptr_Input_uint %gl_SampleMask %uint_0
+%3 = OpAccessChain %_ptr_Input_uint %2
+%4 = OpLoad %uint %3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..1371312
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint x_1[1] = (uint[1])0;
+
+void main_1() {
+ const uint x_4 = x_1[0];
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_Coverage;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1[0] = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..aebd0dd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[1];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_2) {
+ uint const x_4 = (*(tint_symbol_2)).arr[0];
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_mask]]) {
+ thread tint_array_wrapper tint_symbol_3 = {};
+ tint_symbol_3.arr[0] = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..0fa19bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol BuiltIn SampleMask
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Private__arr_uint_uint_1 = OpTypePointer Private %_arr_uint_uint_1
+ %6 = OpConstantNull %_arr_uint_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_uint_uint_1 Private %6
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%tint_symbol = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Input_uint = OpTypePointer Input %uint
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %16 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %17 = OpLoad %uint %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %19 = OpLabel
+ %20 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %22 = OpAccessChain %_ptr_Input_uint %tint_symbol %int_0
+ %23 = OpLoad %uint %22
+ OpStore %20 %23
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..e5d5580
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : array<u32, 1>;
+
+fn main_1() {
+ let x_4 : u32 = x_1[0];
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_mask)]] x_1_param : u32) {
+ x_1[0] = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm
new file mode 100644
index 0000000..d0d60ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 26
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %5 "main" %gl_SampleMask
+OpExecutionMode %5 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%gl_SampleMask = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+%5 = OpFunction %void None %7
+%25 = OpLabel
+%2 = OpAccessChain %_ptr_Input_uint %gl_SampleMask %uint_0
+%3 = OpCopyObject %_ptr_Input_uint %2
+%4 = OpLoad %uint %3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.hlsl
new file mode 100644
index 0000000..1371312
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint x_1[1] = (uint[1])0;
+
+void main_1() {
+ const uint x_4 = x_1[0];
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_Coverage;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1[0] = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.msl
new file mode 100644
index 0000000..aebd0dd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[1];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_2) {
+ uint const x_4 = (*(tint_symbol_2)).arr[0];
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_mask]]) {
+ thread tint_array_wrapper tint_symbol_3 = {};
+ tint_symbol_3.arr[0] = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.spvasm
new file mode 100644
index 0000000..0fa19bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol BuiltIn SampleMask
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Private__arr_uint_uint_1 = OpTypePointer Private %_arr_uint_uint_1
+ %6 = OpConstantNull %_arr_uint_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_uint_uint_1 Private %6
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%tint_symbol = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Input_uint = OpTypePointer Input %uint
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %16 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %17 = OpLoad %uint %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %19 = OpLabel
+ %20 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %22 = OpAccessChain %_ptr_Input_uint %tint_symbol %int_0
+ %23 = OpLoad %uint %22
+ OpStore %20 %23
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.wgsl
new file mode 100644
index 0000000..e5d5580
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : array<u32, 1>;
+
+fn main_1() {
+ let x_4 : u32 = x_1[0];
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_mask)]] x_1_param : u32) {
+ x_1[0] = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm
new file mode 100644
index 0000000..98f35f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm
@@ -0,0 +1,38 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 25
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %4 "main" %gl_SampleMask
+OpExecutionMode %4 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%gl_SampleMask = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+%4 = OpFunction %void None %6
+%24 = OpLabel
+%2 = OpAccessChain %_ptr_Input_uint %gl_SampleMask %uint_0
+%3 = OpLoad %uint %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.hlsl
new file mode 100644
index 0000000..4654682
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint x_1[1] = (uint[1])0;
+
+void main_1() {
+ const uint x_3 = x_1[0];
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_Coverage;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1[0] = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.msl
new file mode 100644
index 0000000..210b39c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[1];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_2) {
+ uint const x_3 = (*(tint_symbol_2)).arr[0];
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_mask]]) {
+ thread tint_array_wrapper tint_symbol_3 = {};
+ tint_symbol_3.arr[0] = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.spvasm
new file mode 100644
index 0000000..0fa19bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol BuiltIn SampleMask
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Private__arr_uint_uint_1 = OpTypePointer Private %_arr_uint_uint_1
+ %6 = OpConstantNull %_arr_uint_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_uint_uint_1 Private %6
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%tint_symbol = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Input_uint = OpTypePointer Input %uint
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %16 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %17 = OpLoad %uint %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %19 = OpLabel
+ %20 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %22 = OpAccessChain %_ptr_Input_uint %tint_symbol %int_0
+ %23 = OpLoad %uint %22
+ OpStore %20 %23
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.wgsl
new file mode 100644
index 0000000..911c8ad
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_1 : array<u32, 1>;
+
+fn main_1() {
+ let x_3 : u32 = x_1[0];
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_mask)]] x_1_param : u32) {
+ x_1[0] = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm
new file mode 100644
index 0000000..30d997f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm
@@ -0,0 +1,42 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 25
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %4 "main" %gl_SampleMask
+OpExecutionMode %4 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+OpDecorate %_arr_uint_uint_1 ArrayStride 4
+OpDecorate %_arr_uint_uint_2 ArrayStride 4
+OpDecorate %_arr_int_uint_1 ArrayStride 4
+OpDecorate %_arr_int_uint_2 ArrayStride 4
+%void = OpTypeVoid
+%10 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%gl_SampleMask = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+%4 = OpFunction %void None %10
+%24 = OpLabel
+%2 = OpAccessChain %_ptr_Input_uint %gl_SampleMask %uint_0
+%3 = OpLoad %uint %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.hlsl
new file mode 100644
index 0000000..4654682
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint x_1[1] = (uint[1])0;
+
+void main_1() {
+ const uint x_3 = x_1[0];
+ return;
+}
+
+struct tint_symbol_1 {
+ uint x_1_param : SV_Coverage;
+};
+
+void main(tint_symbol_1 tint_symbol) {
+ const uint x_1_param = tint_symbol.x_1_param;
+ x_1[0] = x_1_param;
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.msl
new file mode 100644
index 0000000..1c10d95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.msl
@@ -0,0 +1,28 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[1];
+};
+struct tint_array_wrapper_1 {
+ uint arr[2];
+};
+struct tint_array_wrapper_2 {
+ int arr[1];
+};
+struct tint_array_wrapper_3 {
+ int arr[2];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_2) {
+ uint const x_3 = (*(tint_symbol_2)).arr[0];
+ return;
+}
+
+fragment void tint_symbol(uint x_1_param [[sample_mask]]) {
+ thread tint_array_wrapper tint_symbol_3 = {};
+ tint_symbol_3.arr[0] = x_1_param;
+ main_1(&(tint_symbol_3));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.spvasm
new file mode 100644
index 0000000..0fa19bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol BuiltIn SampleMask
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Private__arr_uint_uint_1 = OpTypePointer Private %_arr_uint_uint_1
+ %6 = OpConstantNull %_arr_uint_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_uint_uint_1 Private %6
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%tint_symbol = OpVariable %_ptr_Input__arr_uint_uint_1 Input
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Input_uint = OpTypePointer Input %uint
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %16 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %17 = OpLoad %uint %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %19 = OpLabel
+ %20 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %22 = OpAccessChain %_ptr_Input_uint %tint_symbol %int_0
+ %23 = OpLoad %uint %22
+ OpStore %20 %23
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.wgsl
new file mode 100644
index 0000000..d0434bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+type Arr = [[stride(4)]] array<u32, 1>;
+
+type Arr_1 = [[stride(4)]] array<u32, 2>;
+
+type Arr_2 = [[stride(4)]] array<i32, 1>;
+
+type Arr_3 = [[stride(4)]] array<i32, 2>;
+
+var<private> x_1 : Arr;
+
+fn main_1() {
+ let x_3 : u32 = x_1[0];
+ return;
+}
+
+[[stage(fragment)]]
+fn main([[builtin(sample_mask)]] x_1_param : u32) {
+ x_1[0] = x_1_param;
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm
new file mode 100644
index 0000000..1cb5b10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 25
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %4 "main" %gl_SampleMask
+OpExecutionMode %4 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_int_uint_1 = OpTypePointer Input %_arr_int_uint_1
+%_ptr_Output__arr_int_uint_1 = OpTypePointer Output %_arr_int_uint_1
+%gl_SampleMask = OpVariable %_ptr_Output__arr_int_uint_1 Output
+%4 = OpFunction %void None %6
+%24 = OpLabel
+%2 = OpAccessChain %_ptr_Output_int %gl_SampleMask %uint_0
+%3 = OpAccessChain %_ptr_Output_int %2
+OpStore %2 %int_12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..65e2701
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static int x_1[1] = (int[1])0;
+
+void main_1() {
+ x_1[0] = 12;
+ return;
+}
+
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol {
+ uint x_1_1 : SV_Coverage;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {asuint(x_1[0])};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..ba3a014
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ int arr[1];
+};
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_1_1 [[sample_mask]];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_4) {
+ (*(tint_symbol_4)).arr[0] = 12;
+ return;
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ thread tint_array_wrapper tint_symbol_5 = {};
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.x_1_1=as_type<uint>(tint_symbol_5.arr[0])};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..709f912
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.spvasm
@@ -0,0 +1,64 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol_1
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %_arr_int_uint_1 ArrayStride 4
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol_1 BuiltIn SampleMask
+ OpMemberDecorate %main_out 0 Offset 0
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_ptr_Private__arr_int_uint_1 = OpTypePointer Private %_arr_int_uint_1
+ %7 = OpConstantNull %_arr_int_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_int_uint_1 Private %7
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+ %11 = OpConstantNull %_arr_uint_uint_1
+%tint_symbol_1 = OpVariable %_ptr_Output__arr_uint_uint_1 Output %11
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int_0 = OpConstant %int 0
+%_ptr_Private_int = OpTypePointer Private %int
+ %int_12 = OpConstant %int 12
+ %main_out = OpTypeStruct %uint
+ %20 = OpTypeFunction %void %main_out
+%_ptr_Output_uint = OpTypePointer Output %uint
+ %main_1 = OpFunction %void None %12
+ %15 = OpLabel
+ %18 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ OpStore %18 %int_12
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %20
+%tint_symbol = OpFunctionParameter %main_out
+ %24 = OpLabel
+ %26 = OpAccessChain %_ptr_Output_uint %tint_symbol_1 %int_0
+ %27 = OpCompositeExtract %uint %tint_symbol 0
+ OpStore %26 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %12
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %main_1
+ %33 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ %34 = OpLoad %int %33
+ %32 = OpBitcast %uint %34
+ %35 = OpCompositeConstruct %main_out %32
+ %31 = OpFunctionCall %void %tint_symbol_2 %35
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..42f0760
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> x_1 : array<i32, 1>;
+
+fn main_1() {
+ x_1[0] = 12;
+ return;
+}
+
+struct main_out {
+ [[builtin(sample_mask)]]
+ x_1_1 : u32;
+};
+
+[[stage(fragment)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(bitcast<u32>(x_1[0]));
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm
new file mode 100644
index 0000000..02285ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 25
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %4 "main" %gl_SampleMask
+OpExecutionMode %4 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_int_uint_1 = OpTypePointer Input %_arr_int_uint_1
+%_ptr_Output__arr_int_uint_1 = OpTypePointer Output %_arr_int_uint_1
+%gl_SampleMask = OpVariable %_ptr_Output__arr_int_uint_1 Output
+%4 = OpFunction %void None %6
+%24 = OpLabel
+%2 = OpAccessChain %_ptr_Output_int %gl_SampleMask %uint_0
+%3 = OpCopyObject %_ptr_Output_int %2
+OpStore %2 %int_12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.hlsl
new file mode 100644
index 0000000..65e2701
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static int x_1[1] = (int[1])0;
+
+void main_1() {
+ x_1[0] = 12;
+ return;
+}
+
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol {
+ uint x_1_1 : SV_Coverage;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {asuint(x_1[0])};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.msl
new file mode 100644
index 0000000..ba3a014
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ int arr[1];
+};
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_1_1 [[sample_mask]];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_4) {
+ (*(tint_symbol_4)).arr[0] = 12;
+ return;
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ thread tint_array_wrapper tint_symbol_5 = {};
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.x_1_1=as_type<uint>(tint_symbol_5.arr[0])};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.spvasm
new file mode 100644
index 0000000..709f912
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.spvasm
@@ -0,0 +1,64 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol_1
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %_arr_int_uint_1 ArrayStride 4
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol_1 BuiltIn SampleMask
+ OpMemberDecorate %main_out 0 Offset 0
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_ptr_Private__arr_int_uint_1 = OpTypePointer Private %_arr_int_uint_1
+ %7 = OpConstantNull %_arr_int_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_int_uint_1 Private %7
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+ %11 = OpConstantNull %_arr_uint_uint_1
+%tint_symbol_1 = OpVariable %_ptr_Output__arr_uint_uint_1 Output %11
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int_0 = OpConstant %int 0
+%_ptr_Private_int = OpTypePointer Private %int
+ %int_12 = OpConstant %int 12
+ %main_out = OpTypeStruct %uint
+ %20 = OpTypeFunction %void %main_out
+%_ptr_Output_uint = OpTypePointer Output %uint
+ %main_1 = OpFunction %void None %12
+ %15 = OpLabel
+ %18 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ OpStore %18 %int_12
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %20
+%tint_symbol = OpFunctionParameter %main_out
+ %24 = OpLabel
+ %26 = OpAccessChain %_ptr_Output_uint %tint_symbol_1 %int_0
+ %27 = OpCompositeExtract %uint %tint_symbol 0
+ OpStore %26 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %12
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %main_1
+ %33 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ %34 = OpLoad %int %33
+ %32 = OpBitcast %uint %34
+ %35 = OpCompositeConstruct %main_out %32
+ %31 = OpFunctionCall %void %tint_symbol_2 %35
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.wgsl
new file mode 100644
index 0000000..42f0760
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> x_1 : array<i32, 1>;
+
+fn main_1() {
+ x_1[0] = 12;
+ return;
+}
+
+struct main_out {
+ [[builtin(sample_mask)]]
+ x_1_1 : u32;
+};
+
+[[stage(fragment)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(bitcast<u32>(x_1[0]));
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm
new file mode 100644
index 0000000..f63600f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm
@@ -0,0 +1,38 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 24
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %3 "main" %gl_SampleMask
+OpExecutionMode %3 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_int_uint_1 = OpTypePointer Input %_arr_int_uint_1
+%_ptr_Output__arr_int_uint_1 = OpTypePointer Output %_arr_int_uint_1
+%gl_SampleMask = OpVariable %_ptr_Output__arr_int_uint_1 Output
+%3 = OpFunction %void None %5
+%23 = OpLabel
+%2 = OpAccessChain %_ptr_Output_int %gl_SampleMask %uint_0
+OpStore %2 %int_12
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.hlsl
new file mode 100644
index 0000000..65e2701
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static int x_1[1] = (int[1])0;
+
+void main_1() {
+ x_1[0] = 12;
+ return;
+}
+
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol {
+ uint x_1_1 : SV_Coverage;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {asuint(x_1[0])};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.msl
new file mode 100644
index 0000000..ba3a014
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ int arr[1];
+};
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_1_1 [[sample_mask]];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_4) {
+ (*(tint_symbol_4)).arr[0] = 12;
+ return;
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ thread tint_array_wrapper tint_symbol_5 = {};
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.x_1_1=as_type<uint>(tint_symbol_5.arr[0])};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.spvasm
new file mode 100644
index 0000000..709f912
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.spvasm
@@ -0,0 +1,64 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol_1
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %_arr_int_uint_1 ArrayStride 4
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol_1 BuiltIn SampleMask
+ OpMemberDecorate %main_out 0 Offset 0
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_ptr_Private__arr_int_uint_1 = OpTypePointer Private %_arr_int_uint_1
+ %7 = OpConstantNull %_arr_int_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_int_uint_1 Private %7
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+ %11 = OpConstantNull %_arr_uint_uint_1
+%tint_symbol_1 = OpVariable %_ptr_Output__arr_uint_uint_1 Output %11
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int_0 = OpConstant %int 0
+%_ptr_Private_int = OpTypePointer Private %int
+ %int_12 = OpConstant %int 12
+ %main_out = OpTypeStruct %uint
+ %20 = OpTypeFunction %void %main_out
+%_ptr_Output_uint = OpTypePointer Output %uint
+ %main_1 = OpFunction %void None %12
+ %15 = OpLabel
+ %18 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ OpStore %18 %int_12
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %20
+%tint_symbol = OpFunctionParameter %main_out
+ %24 = OpLabel
+ %26 = OpAccessChain %_ptr_Output_uint %tint_symbol_1 %int_0
+ %27 = OpCompositeExtract %uint %tint_symbol 0
+ OpStore %26 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %12
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %main_1
+ %33 = OpAccessChain %_ptr_Private_int %x_1 %int_0
+ %34 = OpLoad %int %33
+ %32 = OpBitcast %uint %34
+ %35 = OpCompositeConstruct %main_out %32
+ %31 = OpFunctionCall %void %tint_symbol_2 %35
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.wgsl
new file mode 100644
index 0000000..42f0760
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> x_1 : array<i32, 1>;
+
+fn main_1() {
+ x_1[0] = 12;
+ return;
+}
+
+struct main_out {
+ [[builtin(sample_mask)]]
+ x_1_1 : u32;
+};
+
+[[stage(fragment)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(bitcast<u32>(x_1[0]));
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm
new file mode 100644
index 0000000..28e9dc7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 25
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %4 "main" %gl_SampleMask
+OpExecutionMode %4 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%gl_SampleMask = OpVariable %_ptr_Output__arr_uint_uint_1 Output
+%4 = OpFunction %void None %6
+%24 = OpLabel
+%2 = OpAccessChain %_ptr_Output_uint %gl_SampleMask %uint_0
+%3 = OpAccessChain %_ptr_Output_uint %2
+OpStore %2 %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6c36ef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint x_1[1] = (uint[1])0;
+
+void main_1() {
+ x_1[0] = 0u;
+ return;
+}
+
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol {
+ uint x_1_1 : SV_Coverage;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_1[0]};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..2c55170
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[1];
+};
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_1_1 [[sample_mask]];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_4) {
+ (*(tint_symbol_4)).arr[0] = 0u;
+ return;
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ thread tint_array_wrapper tint_symbol_5 = {};
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.x_1_1=tint_symbol_5.arr[0]};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..5fc4f5f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol_1
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol_1 BuiltIn SampleMask
+ OpMemberDecorate %main_out 0 Offset 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Private__arr_uint_uint_1 = OpTypePointer Private %_arr_uint_uint_1
+ %6 = OpConstantNull %_arr_uint_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_uint_uint_1 Private %6
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%tint_symbol_1 = OpVariable %_ptr_Output__arr_uint_uint_1 Output %6
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %uint_0 = OpConstant %uint 0
+ %main_out = OpTypeStruct %uint
+ %18 = OpTypeFunction %void %main_out
+%_ptr_Output_uint = OpTypePointer Output %uint
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %16 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ OpStore %16 %uint_0
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %18
+%tint_symbol = OpFunctionParameter %main_out
+ %22 = OpLabel
+ %24 = OpAccessChain %_ptr_Output_uint %tint_symbol_1 %int_0
+ %25 = OpCompositeExtract %uint %tint_symbol 0
+ OpStore %24 %25
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %main_1
+ %30 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %31 = OpLoad %uint %30
+ %32 = OpCompositeConstruct %main_out %31
+ %29 = OpFunctionCall %void %tint_symbol_2 %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..8791e1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> x_1 : array<u32, 1>;
+
+fn main_1() {
+ x_1[0] = 0u;
+ return;
+}
+
+struct main_out {
+ [[builtin(sample_mask)]]
+ x_1_1 : u32;
+};
+
+[[stage(fragment)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_1[0]);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm
new file mode 100644
index 0000000..df3f581
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 25
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %4 "main" %gl_SampleMask
+OpExecutionMode %4 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%gl_SampleMask = OpVariable %_ptr_Output__arr_uint_uint_1 Output
+%4 = OpFunction %void None %6
+%24 = OpLabel
+%2 = OpAccessChain %_ptr_Output_uint %gl_SampleMask %uint_0
+%3 = OpCopyObject %_ptr_Output_uint %2
+OpStore %2 %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6c36ef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint x_1[1] = (uint[1])0;
+
+void main_1() {
+ x_1[0] = 0u;
+ return;
+}
+
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol {
+ uint x_1_1 : SV_Coverage;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_1[0]};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.msl
new file mode 100644
index 0000000..2c55170
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[1];
+};
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_1_1 [[sample_mask]];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_4) {
+ (*(tint_symbol_4)).arr[0] = 0u;
+ return;
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ thread tint_array_wrapper tint_symbol_5 = {};
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.x_1_1=tint_symbol_5.arr[0]};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.spvasm
new file mode 100644
index 0000000..5fc4f5f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol_1
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol_1 BuiltIn SampleMask
+ OpMemberDecorate %main_out 0 Offset 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Private__arr_uint_uint_1 = OpTypePointer Private %_arr_uint_uint_1
+ %6 = OpConstantNull %_arr_uint_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_uint_uint_1 Private %6
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%tint_symbol_1 = OpVariable %_ptr_Output__arr_uint_uint_1 Output %6
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %uint_0 = OpConstant %uint 0
+ %main_out = OpTypeStruct %uint
+ %18 = OpTypeFunction %void %main_out
+%_ptr_Output_uint = OpTypePointer Output %uint
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %16 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ OpStore %16 %uint_0
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %18
+%tint_symbol = OpFunctionParameter %main_out
+ %22 = OpLabel
+ %24 = OpAccessChain %_ptr_Output_uint %tint_symbol_1 %int_0
+ %25 = OpCompositeExtract %uint %tint_symbol 0
+ OpStore %24 %25
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %main_1
+ %30 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %31 = OpLoad %uint %30
+ %32 = OpCompositeConstruct %main_out %31
+ %29 = OpFunctionCall %void %tint_symbol_2 %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.wgsl
new file mode 100644
index 0000000..8791e1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> x_1 : array<u32, 1>;
+
+fn main_1() {
+ x_1[0] = 0u;
+ return;
+}
+
+struct main_out {
+ [[builtin(sample_mask)]]
+ x_1_1 : u32;
+};
+
+[[stage(fragment)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_1[0]);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm
new file mode 100644
index 0000000..f62eda1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm
@@ -0,0 +1,38 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 24
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %3 "main" %gl_SampleMask
+OpExecutionMode %3 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%gl_SampleMask = OpVariable %_ptr_Output__arr_uint_uint_1 Output
+%3 = OpFunction %void None %5
+%23 = OpLabel
+%2 = OpAccessChain %_ptr_Output_uint %gl_SampleMask %uint_0
+OpStore %2 %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6c36ef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint x_1[1] = (uint[1])0;
+
+void main_1() {
+ x_1[0] = 0u;
+ return;
+}
+
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol {
+ uint x_1_1 : SV_Coverage;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_1[0]};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.msl
new file mode 100644
index 0000000..2c55170
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[1];
+};
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_1_1 [[sample_mask]];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_4) {
+ (*(tint_symbol_4)).arr[0] = 0u;
+ return;
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ thread tint_array_wrapper tint_symbol_5 = {};
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.x_1_1=tint_symbol_5.arr[0]};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.spvasm
new file mode 100644
index 0000000..5fc4f5f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol_1
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol_1 BuiltIn SampleMask
+ OpMemberDecorate %main_out 0 Offset 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Private__arr_uint_uint_1 = OpTypePointer Private %_arr_uint_uint_1
+ %6 = OpConstantNull %_arr_uint_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_uint_uint_1 Private %6
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%tint_symbol_1 = OpVariable %_ptr_Output__arr_uint_uint_1 Output %6
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %uint_0 = OpConstant %uint 0
+ %main_out = OpTypeStruct %uint
+ %18 = OpTypeFunction %void %main_out
+%_ptr_Output_uint = OpTypePointer Output %uint
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %16 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ OpStore %16 %uint_0
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %18
+%tint_symbol = OpFunctionParameter %main_out
+ %22 = OpLabel
+ %24 = OpAccessChain %_ptr_Output_uint %tint_symbol_1 %int_0
+ %25 = OpCompositeExtract %uint %tint_symbol 0
+ OpStore %24 %25
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %main_1
+ %30 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %31 = OpLoad %uint %30
+ %32 = OpCompositeConstruct %main_out %31
+ %29 = OpFunctionCall %void %tint_symbol_2 %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.wgsl
new file mode 100644
index 0000000..8791e1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> x_1 : array<u32, 1>;
+
+fn main_1() {
+ x_1[0] = 0u;
+ return;
+}
+
+struct main_out {
+ [[builtin(sample_mask)]]
+ x_1_1 : u32;
+};
+
+[[stage(fragment)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_1[0]);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm
new file mode 100644
index 0000000..5a6e396
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm
@@ -0,0 +1,42 @@
+; Test: SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 24
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %3 "main" %gl_SampleMask
+OpExecutionMode %3 OriginUpperLeft
+OpDecorate %gl_SampleMask BuiltIn SampleMask
+OpDecorate %_arr_uint_uint_1 ArrayStride 4
+OpDecorate %_arr_uint_uint_2 ArrayStride 4
+OpDecorate %_arr_int_uint_1 ArrayStride 4
+OpDecorate %_arr_int_uint_2 ArrayStride 4
+%void = OpTypeVoid
+%9 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_12 = OpConstant %int 12
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_arr_int_uint_1 = OpTypeArray %int %uint_1
+%_arr_int_uint_2 = OpTypeArray %int %uint_2
+%_ptr_Input_int = OpTypePointer Input %int
+%_ptr_Input_uint = OpTypePointer Input %uint
+%_ptr_Output_int = OpTypePointer Output %int
+%_ptr_Output_uint = OpTypePointer Output %uint
+%_ptr_Input__arr_uint_uint_1 = OpTypePointer Input %_arr_uint_uint_1
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%gl_SampleMask = OpVariable %_ptr_Output__arr_uint_uint_1 Output
+%3 = OpFunction %void None %9
+%23 = OpLabel
+%2 = OpAccessChain %_ptr_Output_uint %gl_SampleMask %uint_0
+OpStore %2 %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6c36ef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint x_1[1] = (uint[1])0;
+
+void main_1() {
+ x_1[0] = 0u;
+ return;
+}
+
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol {
+ uint x_1_1 : SV_Coverage;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_1[0]};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_1_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.msl
new file mode 100644
index 0000000..5a94fee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[1];
+};
+struct tint_array_wrapper_1 {
+ uint arr[2];
+};
+struct tint_array_wrapper_2 {
+ int arr[1];
+};
+struct tint_array_wrapper_3 {
+ int arr[2];
+};
+struct main_out {
+ uint x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_1_1 [[sample_mask]];
+};
+
+void main_1(thread tint_array_wrapper* const tint_symbol_4) {
+ (*(tint_symbol_4)).arr[0] = 0u;
+ return;
+}
+
+fragment tint_symbol_1 tint_symbol() {
+ thread tint_array_wrapper tint_symbol_5 = {};
+ main_1(&(tint_symbol_5));
+ main_out const tint_symbol_2 = {.x_1_1=tint_symbol_5.arr[0]};
+ tint_symbol_1 const tint_symbol_3 = {.x_1_1=tint_symbol_2.x_1_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.spvasm
new file mode 100644
index 0000000..5fc4f5f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %tint_symbol_1
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_1 ArrayStride 4
+ OpDecorate %tint_symbol_1 BuiltIn SampleMask
+ OpMemberDecorate %main_out 0 Offset 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_uint_uint_1 = OpTypeArray %uint %uint_1
+%_ptr_Private__arr_uint_uint_1 = OpTypePointer Private %_arr_uint_uint_1
+ %6 = OpConstantNull %_arr_uint_uint_1
+ %x_1 = OpVariable %_ptr_Private__arr_uint_uint_1 Private %6
+%_ptr_Output__arr_uint_uint_1 = OpTypePointer Output %_arr_uint_uint_1
+%tint_symbol_1 = OpVariable %_ptr_Output__arr_uint_uint_1 Output %6
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %uint_0 = OpConstant %uint 0
+ %main_out = OpTypeStruct %uint
+ %18 = OpTypeFunction %void %main_out
+%_ptr_Output_uint = OpTypePointer Output %uint
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %16 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ OpStore %16 %uint_0
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %18
+%tint_symbol = OpFunctionParameter %main_out
+ %22 = OpLabel
+ %24 = OpAccessChain %_ptr_Output_uint %tint_symbol_1 %int_0
+ %25 = OpCompositeExtract %uint %tint_symbol 0
+ OpStore %24 %25
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %main_1
+ %30 = OpAccessChain %_ptr_Private_uint %x_1 %int_0
+ %31 = OpLoad %uint %30
+ %32 = OpCompositeConstruct %main_out %31
+ %29 = OpFunctionCall %void %tint_symbol_2 %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.wgsl
new file mode 100644
index 0000000..fdce3e2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+type Arr = [[stride(4)]] array<u32, 1>;
+
+type Arr_1 = [[stride(4)]] array<u32, 2>;
+
+type Arr_2 = [[stride(4)]] array<i32, 1>;
+
+type Arr_3 = [[stride(4)]] array<i32, 2>;
+
+var<private> x_1 : Arr;
+
+fn main_1() {
+ x_1[0] = 0u;
+ return;
+}
+
+struct main_out {
+ [[builtin(sample_mask)]]
+ x_1_1 : u32;
+};
+
+[[stage(fragment)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_1[0]);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm
new file mode 100644
index 0000000..326d5bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvModuleScopeVarParserTest_ScalarInitializers.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 33
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %6 "main"
+OpExecutionMode %6 OriginUpperLeft
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%1 = OpVariable %_ptr_Private_bool Private %true
+%2 = OpVariable %_ptr_Private_bool Private %false
+%3 = OpVariable %_ptr_Private_int Private %int_n1
+%4 = OpVariable %_ptr_Private_uint Private %uint_1
+%5 = OpVariable %_ptr_Private_float Private %float_1_5
+%6 = OpFunction %void None %8
+%32 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.hlsl
new file mode 100644
index 0000000..f31c427
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static bool x_1 = true;
+static bool x_2 = false;
+static int x_3 = -1;
+static uint x_4 = 1u;
+static float x_5 = 1.5f;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.spvasm
new file mode 100644
index 0000000..dc898fe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %x_3 "x_3"
+ OpName %x_4 "x_4"
+ OpName %x_5 "x_5"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+%_ptr_Private_bool = OpTypePointer Private %bool
+ %x_1 = OpVariable %_ptr_Private_bool Private %true
+ %false = OpConstantFalse %bool
+ %x_2 = OpVariable %_ptr_Private_bool Private %false
+ %int = OpTypeInt 32 1
+ %int_n1 = OpConstant %int -1
+%_ptr_Private_int = OpTypePointer Private %int
+ %x_3 = OpVariable %_ptr_Private_int Private %int_n1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %x_4 = OpVariable %_ptr_Private_uint Private %uint_1
+ %float = OpTypeFloat 32
+ %float_1_5 = OpConstant %float 1.5
+%_ptr_Private_float = OpTypePointer Private %float
+ %x_5 = OpVariable %_ptr_Private_float Private %float_1_5
+ %void = OpTypeVoid
+ %19 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %19
+ %22 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %19
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.wgsl
new file mode 100644
index 0000000..22083e1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> x_1 : bool = true;
+
+var<private> x_2 : bool = false;
+
+var<private> x_3 : i32 = -1;
+
+var<private> x_4 : u32 = 1u;
+
+var<private> x_5 : f32 = 1.5;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm
new file mode 100644
index 0000000..c446686
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 36
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %5 "main"
+OpExecutionMode %5 OriginUpperLeft
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%31 = OpConstantNull %bool
+%32 = OpConstantNull %int
+%33 = OpConstantNull %uint
+%34 = OpConstantNull %float
+%1 = OpVariable %_ptr_Private_bool Private %31
+%2 = OpVariable %_ptr_Private_int Private %32
+%3 = OpVariable %_ptr_Private_uint Private %33
+%4 = OpVariable %_ptr_Private_float Private %34
+%5 = OpFunction %void None %7
+%35 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.hlsl
new file mode 100644
index 0000000..1488be8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+static bool x_1 = false;
+static int x_2 = 0;
+static uint x_3 = 0u;
+static float x_4 = 0.0f;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.spvasm
new file mode 100644
index 0000000..29592b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %x_3 "x_3"
+ OpName %x_4 "x_4"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+%_ptr_Private_bool = OpTypePointer Private %bool
+ %x_1 = OpVariable %_ptr_Private_bool Private %false
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Private_int = OpTypePointer Private %int
+ %x_2 = OpVariable %_ptr_Private_int Private %int_0
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %x_3 = OpVariable %_ptr_Private_uint Private %uint_0
+ %float = OpTypeFloat 32
+ %float_0 = OpConstant %float 0
+%_ptr_Private_float = OpTypePointer Private %float
+ %x_4 = OpVariable %_ptr_Private_float Private %float_0
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.wgsl
new file mode 100644
index 0000000..aa25194
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> x_1 : bool = false;
+
+var<private> x_2 : i32 = 0;
+
+var<private> x_3 : u32 = 0u;
+
+var<private> x_4 : f32 = 0.0;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm
new file mode 100644
index 0000000..4495762
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %myconst "myconst"
+OpDecorate %myconst SpecId 12
+%float = OpTypeFloat 32
+%myconst = OpSpecConstant %float 2.5
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.hlsl
new file mode 100644
index 0000000..566f341
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+#ifndef WGSL_SPEC_CONSTANT_12
+#define WGSL_SPEC_CONSTANT_12 2.5f
+#endif
+static const float myconst = WGSL_SPEC_CONSTANT_12;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.msl
new file mode 100644
index 0000000..4677fca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant float myconst [[function_constant(12)]];
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.spvasm
new file mode 100644
index 0000000..9972bb5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 10
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %myconst "myconst"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %myconst SpecId 12
+ %float = OpTypeFloat 32
+ %myconst = OpSpecConstant %float 2.5
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %3
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %3
+ %8 = OpLabel
+ %9 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.wgsl
new file mode 100644
index 0000000..db31ce6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+[[override(12)]] let myconst : f32 = 2.5;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm
new file mode 100644
index 0000000..a4b993f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm
@@ -0,0 +1,20 @@
+; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %myconst "myconst"
+%float = OpTypeFloat 32
+%myconst = OpSpecConstant %float 2.5
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.hlsl
new file mode 100644
index 0000000..381aa13
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static const float myconst = 2.5f;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.msl
new file mode 100644
index 0000000..dcbce29
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant float myconst = 2.5f;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.spvasm
new file mode 100644
index 0000000..eda6c88
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.spvasm
@@ -0,0 +1,25 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 10
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %myconst "myconst"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %float = OpTypeFloat 32
+ %myconst = OpConstant %float 2.5
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %3
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %3
+ %8 = OpLabel
+ %9 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.wgsl
new file mode 100644
index 0000000..9821d8b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+let myconst : f32 = 2.5;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm
new file mode 100644
index 0000000..ae487d5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %myconst "myconst"
+OpDecorate %myconst SpecId 12
+%bool = OpTypeBool
+%myconst = OpSpecConstantFalse %bool
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.hlsl
new file mode 100644
index 0000000..1f95b39
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+#ifndef WGSL_SPEC_CONSTANT_12
+#define WGSL_SPEC_CONSTANT_12 false
+#endif
+static const bool myconst = WGSL_SPEC_CONSTANT_12;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.msl
new file mode 100644
index 0000000..fe268c4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant bool myconst [[function_constant(12)]];
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.spvasm
new file mode 100644
index 0000000..213d2fd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 10
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %myconst "myconst"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %myconst SpecId 12
+ %bool = OpTypeBool
+ %myconst = OpSpecConstantFalse %bool
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %3
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %3
+ %8 = OpLabel
+ %9 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.wgsl
new file mode 100644
index 0000000..58606bc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+[[override(12)]] let myconst : bool = false;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm
new file mode 100644
index 0000000..c955a79
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %myconst "myconst"
+OpDecorate %myconst SpecId 12
+%int = OpTypeInt 32 1
+%myconst = OpSpecConstant %int 42
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.hlsl
new file mode 100644
index 0000000..e2f518b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+#ifndef WGSL_SPEC_CONSTANT_12
+#define WGSL_SPEC_CONSTANT_12 42
+#endif
+static const int myconst = WGSL_SPEC_CONSTANT_12;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.msl
new file mode 100644
index 0000000..a23617b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant int myconst [[function_constant(12)]];
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.spvasm
new file mode 100644
index 0000000..de23b73
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 10
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %myconst "myconst"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %myconst SpecId 12
+ %int = OpTypeInt 32 1
+ %myconst = OpSpecConstant %int 42
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %3
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %3
+ %8 = OpLabel
+ %9 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.wgsl
new file mode 100644
index 0000000..f6d39f8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+[[override(12)]] let myconst : i32 = 42;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm
new file mode 100644
index 0000000..c687c93
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm
@@ -0,0 +1,20 @@
+; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %1 SpecId 65535
+%bool = OpTypeBool
+%1 = OpSpecConstantTrue %bool
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%2 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.hlsl
new file mode 100644
index 0000000..960b2a2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+#ifndef WGSL_SPEC_CONSTANT_65535
+#define WGSL_SPEC_CONSTANT_65535 true
+#endif
+static const bool x_1 = WGSL_SPEC_CONSTANT_65535;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.msl
new file mode 100644
index 0000000..2d9ab1d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant bool x_1 [[function_constant(65535)]];
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.spvasm
new file mode 100644
index 0000000..23b6d79
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 10
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_1 SpecId 65535
+ %bool = OpTypeBool
+ %x_1 = OpSpecConstantTrue %bool
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %3
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %3
+ %8 = OpLabel
+ %9 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.wgsl
new file mode 100644
index 0000000..cb4864e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+[[override(65535)]] let x_1 : bool = true;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm
new file mode 100644
index 0000000..1f56e04
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %myconst "myconst"
+OpDecorate %myconst SpecId 12
+%bool = OpTypeBool
+%myconst = OpSpecConstantTrue %bool
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.hlsl
new file mode 100644
index 0000000..1603206
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+#ifndef WGSL_SPEC_CONSTANT_12
+#define WGSL_SPEC_CONSTANT_12 true
+#endif
+static const bool myconst = WGSL_SPEC_CONSTANT_12;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.msl
new file mode 100644
index 0000000..fe268c4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant bool myconst [[function_constant(12)]];
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.spvasm
new file mode 100644
index 0000000..2770f9e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 10
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %myconst "myconst"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %myconst SpecId 12
+ %bool = OpTypeBool
+ %myconst = OpSpecConstantTrue %bool
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %3
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %3
+ %8 = OpLabel
+ %9 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.wgsl
new file mode 100644
index 0000000..caa65dc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+[[override(12)]] let myconst : bool = true;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm
new file mode 100644
index 0000000..2ab2c75
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpName %myconst "myconst"
+OpDecorate %myconst SpecId 12
+%uint = OpTypeInt 32 0
+%myconst = OpSpecConstant %uint 42
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.hlsl
new file mode 100644
index 0000000..ba040ea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+#ifndef WGSL_SPEC_CONSTANT_12
+#define WGSL_SPEC_CONSTANT_12 42u
+#endif
+static const uint myconst = WGSL_SPEC_CONSTANT_12;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.msl
new file mode 100644
index 0000000..19c2af7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant uint myconst [[function_constant(12)]];
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.spvasm
new file mode 100644
index 0000000..9461ab1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 10
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %myconst "myconst"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %myconst SpecId 12
+ %uint = OpTypeInt 32 0
+ %myconst = OpSpecConstant %uint 42
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %3
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %3
+ %8 = OpLabel
+ %9 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.wgsl
new file mode 100644
index 0000000..86846ed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+[[override(12)]] let myconst : u32 = 42u;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm
new file mode 100644
index 0000000..096d33f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm
@@ -0,0 +1,26 @@
+; Test: SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+OpName %myconst "myconst"
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%myconst = OpSpecConstant %float 2.5
+%7 = OpTypeFunction %float
+%100 = OpFunction %float None %7
+%8 = OpLabel
+%1 = OpFAdd %float %myconst %myconst
+OpReturnValue %1
+OpFunctionEnd
+%2 = OpFunction %void None %5
+%9 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.hlsl
new file mode 100644
index 0000000..41fb01d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static const float myconst = 2.5f;
+
+float x_100() {
+ return (myconst + myconst);
+}
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.msl
new file mode 100644
index 0000000..c8f2a48
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant float myconst = 2.5f;
+float x_100() {
+ return (myconst + myconst);
+}
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.spvasm
new file mode 100644
index 0000000..8c812c0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %myconst "myconst"
+ OpName %x_100 "x_100"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %float = OpTypeFloat 32
+ %myconst = OpConstant %float 2.5
+ %3 = OpTypeFunction %float
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %x_100 = OpFunction %float None %3
+ %5 = OpLabel
+ %6 = OpFAdd %float %myconst %myconst
+ OpReturnValue %6
+ OpFunctionEnd
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.wgsl
new file mode 100644
index 0000000..3c3108e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.wgsl
@@ -0,0 +1,14 @@
+let myconst : f32 = 2.5;
+
+fn x_100() -> f32 {
+ return (myconst + myconst);
+}
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm
new file mode 100644
index 0000000..7793290
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 9
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %_struct_3 Block
+OpDecorate %1 DescriptorSet 0
+OpDecorate %1 Binding 0
+OpMemberDecorate %_struct_3 0 NonWritable
+OpMemberDecorate %_struct_3 1 NonWritable
+OpMemberDecorate %_struct_3 0 Offset 0
+OpMemberDecorate %_struct_3 1 Offset 4
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%_struct_3 = OpTypeStruct %float %float
+%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3
+%1 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
+%2 = OpFunction %void None %5
+%8 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.hlsl
new file mode 100644
index 0000000..006f2c1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+ByteAddressBuffer x_1 : register(t0, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.msl
new file mode 100644
index 0000000..0766b35
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ /* 0x0000 */ float field0;
+ /* 0x0004 */ float field1;
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.spvasm
new file mode 100644
index 0000000..a8f386b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpDecorate %x_1 NonWritable
+ OpDecorate %x_1 DescriptorSet 0
+ OpDecorate %x_1 Binding 0
+ %float = OpTypeFloat 32
+ %S = OpTypeStruct %float %float
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %x_1 = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.wgsl
new file mode 100644
index 0000000..ff67ffa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+[[block]]
+struct S {
+ field0 : f32;
+ field1 : f32;
+};
+
+[[group(0), binding(0)]] var<storage, read> x_1 : S;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm
new file mode 100644
index 0000000..8c11585
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm
@@ -0,0 +1,27 @@
+; Test: SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 9
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %1 DescriptorSet 0
+OpDecorate %1 Binding 0
+OpDecorate %_struct_3 Block
+OpMemberDecorate %_struct_3 0 NonWritable
+OpMemberDecorate %_struct_3 0 Offset 0
+OpMemberDecorate %_struct_3 1 Offset 4
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%_struct_3 = OpTypeStruct %float %float
+%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3
+%1 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
+%2 = OpFunction %void None %5
+%8 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.hlsl
new file mode 100644
index 0000000..356578f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+RWByteAddressBuffer x_1 : register(u0, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.msl
new file mode 100644
index 0000000..0766b35
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ /* 0x0000 */ float field0;
+ /* 0x0004 */ float field1;
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.spvasm
new file mode 100644
index 0000000..7734cd7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpDecorate %x_1 DescriptorSet 0
+ OpDecorate %x_1 Binding 0
+ %float = OpTypeFloat 32
+ %S = OpTypeStruct %float %float
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %x_1 = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.wgsl
new file mode 100644
index 0000000..408912e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+[[block]]
+struct S {
+ field0 : f32;
+ field1 : f32;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> x_1 : S;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm
new file mode 100644
index 0000000..c2b3547
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 9
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %_struct_3 Block
+OpDecorate %1 DescriptorSet 0
+OpDecorate %1 Binding 0
+OpMemberDecorate %_struct_3 0 NonWritable
+OpMemberDecorate %_struct_3 0 NonWritable
+OpMemberDecorate %_struct_3 0 Offset 0
+OpMemberDecorate %_struct_3 1 Offset 4
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%_struct_3 = OpTypeStruct %float %float
+%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3
+%1 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
+%2 = OpFunction %void None %5
+%8 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.hlsl
new file mode 100644
index 0000000..356578f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+RWByteAddressBuffer x_1 : register(u0, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.msl
new file mode 100644
index 0000000..0766b35
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ /* 0x0000 */ float field0;
+ /* 0x0004 */ float field1;
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.spvasm
new file mode 100644
index 0000000..7734cd7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpDecorate %x_1 DescriptorSet 0
+ OpDecorate %x_1 Binding 0
+ %float = OpTypeFloat 32
+ %S = OpTypeStruct %float %float
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %x_1 = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.wgsl
new file mode 100644
index 0000000..408912e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+[[block]]
+struct S {
+ field0 : f32;
+ field1 : f32;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> x_1 : S;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm
new file mode 100644
index 0000000..e12f585
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvModuleScopeVarParserTest_StructInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_27 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Private__struct_27 = OpTypePointer Private %_struct_27
+%uint_2_0 = OpConstant %uint 2
+%30 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2_0
+%31 = OpConstantComposite %_struct_27 %uint_1 %float_1_5 %30
+%200 = OpVariable %_ptr_Private__struct_27 Private %31
+%1 = OpFunction %void None %3
+%32 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..8e7b09e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+struct S {
+ uint field0;
+ float field1;
+ uint field2[2];
+};
+
+static S x_200 = {1u, 1.5f, {1u, 2u}};
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..967624c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..450c52d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 2 Offset 8
+ OpDecorate %_arr_uint_uint_2 ArrayStride 4
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %S = OpTypeStruct %uint %float %_arr_uint_uint_2
+ %uint_1 = OpConstant %uint 1
+ %float_1_5 = OpConstant %float 1.5
+ %8 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2
+ %9 = OpConstantComposite %S %uint_1 %float_1_5 %8
+%_ptr_Private_S = OpTypePointer Private %S
+ %x_200 = OpVariable %_ptr_Private_S Private %9
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %12
+ %15 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %12
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..ce1529b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+var<private> x_200 : S = S(1u, 1.5, array<u32, 2>(1u, 2u));
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm
new file mode 100644
index 0000000..8c3b06f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 31
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "main"
+OpExecutionMode %2 OriginUpperLeft
+OpDecorate %1 DescriptorSet 0
+OpDecorate %1 Binding 0
+OpDecorate %_struct_3 Block
+OpMemberDecorate %_struct_3 0 NonReadable
+OpMemberDecorate %_struct_3 0 Offset 0
+OpMemberDecorate %_struct_3 1 Offset 4
+OpMemberDecorate %_struct_3 2 Offset 8
+OpDecorate %_arr_uint_uint_2 ArrayStride 4
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_3 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3
+%1 = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
+%2 = OpFunction %void None %6
+%30 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.hlsl
new file mode 100644
index 0000000..356578f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+RWByteAddressBuffer x_1 : register(u0, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.msl
new file mode 100644
index 0000000..fd04641
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ /* 0x0000 */ uint arr[2];
+};
+struct S {
+ /* 0x0000 */ uint field0;
+ /* 0x0004 */ float field1;
+ /* 0x0008 */ tint_array_wrapper field2;
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.spvasm
new file mode 100644
index 0000000..5385430
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.spvasm
@@ -0,0 +1,41 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 2 Offset 8
+ OpDecorate %_arr_uint_uint_2 ArrayStride 4
+ OpDecorate %x_1 DescriptorSet 0
+ OpDecorate %x_1 Binding 0
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %S = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %x_1 = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.wgsl
new file mode 100644
index 0000000..7a1df2a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+type Arr = [[stride(4)]] array<u32, 2>;
+
+[[block]]
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : Arr;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> x_1 : S;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm
new file mode 100644
index 0000000..eedbd48
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm
@@ -0,0 +1,44 @@
+; Test: SpvModuleScopeVarParserTest_StructNullInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_27 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Private__struct_27 = OpTypePointer Private %_struct_27
+%29 = OpConstantNull %_struct_27
+%200 = OpVariable %_ptr_Private__struct_27 Private %29
+%1 = OpFunction %void None %3
+%30 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..630bcc2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+struct S {
+ uint field0;
+ float field1;
+ uint field2[2];
+};
+
+static S x_200 = {0u, 0.0f, {0u, 0u}};
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..967624c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..ede3bc6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 2 Offset 8
+ OpDecorate %_arr_uint_uint_2 ArrayStride 4
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %S = OpTypeStruct %uint %float %_arr_uint_uint_2
+ %uint_0 = OpConstant %uint 0
+ %float_0 = OpConstant %float 0
+ %8 = OpConstantComposite %_arr_uint_uint_2 %uint_0 %uint_0
+ %9 = OpConstantComposite %S %uint_0 %float_0 %8
+%_ptr_Private_S = OpTypePointer Private %S
+ %x_200 = OpVariable %_ptr_Private_S Private %9
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %12
+ %15 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %12
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..46c9e52
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+var<private> x_200 : S = S(0u, 0.0, array<u32, 2>(0u, 0u));
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm
new file mode 100644
index 0000000..cfdd81d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm
@@ -0,0 +1,43 @@
+; Test: SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Private_v2bool = OpTypePointer Private %v2bool
+%28 = OpConstantNull %v2bool
+%200 = OpVariable %_ptr_Private_v2bool Private %28
+%1 = OpFunction %void None %3
+%29 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..3bd690c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static bool2 x_200 = bool2(false, false);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..2b85452
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %false = OpConstantFalse %bool
+ %4 = OpConstantComposite %v2bool %false %false
+%_ptr_Private_v2bool = OpTypePointer Private %v2bool
+ %x_200 = OpVariable %_ptr_Private_v2bool Private %4
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..7d0f3a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_200 : vec2<bool> = vec2<bool>(false, false);
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm
new file mode 100644
index 0000000..8324367
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm
@@ -0,0 +1,43 @@
+; Test: SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Private_v2float = OpTypePointer Private %v2float
+%28 = OpConstantNull %v2float
+%200 = OpVariable %_ptr_Private_v2float Private %28
+%1 = OpFunction %void None %3
+%29 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..09fde37
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static float2 x_200 = float2(0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..a9c49dd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_0 = OpConstant %float 0
+ %4 = OpConstantComposite %v2float %float_0 %float_0
+%_ptr_Private_v2float = OpTypePointer Private %v2float
+ %x_200 = OpVariable %_ptr_Private_v2float Private %4
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..e4716f3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_200 : vec2<f32> = vec2<f32>(0.0, 0.0);
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm
new file mode 100644
index 0000000..6ae1424
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm
@@ -0,0 +1,44 @@
+; Test: SpvModuleScopeVarParserTest_VectorInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Private_v2float = OpTypePointer Private %v2float
+%float_2 = OpConstant %float 2
+%29 = OpConstantComposite %v2float %float_1_5 %float_2
+%200 = OpVariable %_ptr_Private_v2float Private %29
+%1 = OpFunction %void None %3
+%30 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..64afda1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static float2 x_200 = float2(1.5f, 2.0f);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..390aea8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_1_5 = OpConstant %float 1.5
+ %float_2 = OpConstant %float 2
+ %5 = OpConstantComposite %v2float %float_1_5 %float_2
+%_ptr_Private_v2float = OpTypePointer Private %v2float
+ %x_200 = OpVariable %_ptr_Private_v2float Private %5
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..5317c3c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_200 : vec2<f32> = vec2<f32>(1.5, 2.0);
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm
new file mode 100644
index 0000000..5f1dfd4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm
@@ -0,0 +1,43 @@
+; Test: SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Private_v2int = OpTypePointer Private %v2int
+%28 = OpConstantNull %v2int
+%200 = OpVariable %_ptr_Private_v2int Private %28
+%1 = OpFunction %void None %3
+%29 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..f241300
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static int2 x_200 = int2(0, 0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..73eb146
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_0 = OpConstant %int 0
+ %4 = OpConstantComposite %v2int %int_0 %int_0
+%_ptr_Private_v2int = OpTypePointer Private %v2int
+ %x_200 = OpVariable %_ptr_Private_v2int Private %4
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..f602218
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_200 : vec2<i32> = vec2<i32>(0, 0);
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm
new file mode 100644
index 0000000..712904c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm
@@ -0,0 +1,43 @@
+; Test: SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Private_bool = OpTypePointer Private %bool
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_int = OpTypePointer Private %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_14 = OpConstant %int 14
+%uint_2 = OpConstant %uint 2
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v4float = OpTypeVector %float 4
+%mat3v2float = OpTypeMatrix %v2float 3
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_ptr_Private_v2uint = OpTypePointer Private %v2uint
+%28 = OpConstantNull %v2uint
+%200 = OpVariable %_ptr_Private_v2uint Private %28
+%1 = OpFunction %void None %3
+%29 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..0fb91cc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint2 x_200 = uint2(0u, 0u);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..3374b53
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_0 = OpConstant %uint 0
+ %4 = OpConstantComposite %v2uint %uint_0 %uint_0
+%_ptr_Private_v2uint = OpTypePointer Private %v2uint
+ %x_200 = OpVariable %_ptr_Private_v2uint Private %4
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..c248ed3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> x_200 : vec2<u32> = vec2<u32>(0u, 0u);
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm
new file mode 100644
index 0000000..2fdbed6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 15
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %gl_Position %gl_VertexIndex
+OpDecorate %gl_Position BuiltIn Position
+OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_VertexIndex = OpVariable %_ptr_Input_int Input
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%13 = OpLabel
+%14 = OpAccessChain %_ptr_Input_int %gl_VertexIndex
+%2 = OpLoad %int %14
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..8f123562
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static int x_4 = 0;
+static float4 x_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const int x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_VertexID;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = asint(x_4_param);
+ main_1();
+ const main_out tint_symbol_3 = {x_1};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..884397d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 [[position]];
+};
+
+void main_1(thread int* const tint_symbol_5) {
+ int const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[vertex_id]]) {
+ thread int tint_symbol_6 = 0;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = as_type<int>(x_4_param);
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.x_1_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.x_1_1=tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..6416131
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn VertexIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %8 = OpConstantNull %int
+ %x_4 = OpVariable %_ptr_Private_int Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %x_1 = OpVariable %_ptr_Private_v4float Private %12
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %18 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %23 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %18
+ %21 = OpLabel
+ %22 = OpLoad %int %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %23
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %27 = OpLabel
+ %28 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %18
+ %30 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %33 = OpLoad %uint %tint_symbol
+ %32 = OpBitcast %int %33
+ OpStore %x_4 %32
+ %34 = OpFunctionCall %void %main_1
+ %36 = OpLoad %v4float %x_1
+ %37 = OpCompositeConstruct %main_out %36
+ %35 = OpFunctionCall %void %tint_symbol_3 %37
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..43d88d3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> x_4 : i32;
+
+var<private> x_1 : vec4<f32>;
+
+fn main_1() {
+ let x_2 : i32 = x_4;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_1_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(vertex_index)]] x_4_param : u32) -> main_out {
+ x_4 = bitcast<i32>(x_4_param);
+ main_1();
+ return main_out(x_1);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm
new file mode 100644
index 0000000..b504091
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 15
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %gl_Position %gl_VertexIndex
+OpDecorate %gl_Position BuiltIn Position
+OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_VertexIndex = OpVariable %_ptr_Input_int Input
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%13 = OpLabel
+%14 = OpCopyObject %_ptr_Input_int %gl_VertexIndex
+%2 = OpLoad %int %14
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.hlsl
new file mode 100644
index 0000000..8f123562
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static int x_4 = 0;
+static float4 x_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const int x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_VertexID;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = asint(x_4_param);
+ main_1();
+ const main_out tint_symbol_3 = {x_1};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.msl
new file mode 100644
index 0000000..884397d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 [[position]];
+};
+
+void main_1(thread int* const tint_symbol_5) {
+ int const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[vertex_id]]) {
+ thread int tint_symbol_6 = 0;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = as_type<int>(x_4_param);
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.x_1_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.x_1_1=tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.spvasm
new file mode 100644
index 0000000..6416131
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn VertexIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %8 = OpConstantNull %int
+ %x_4 = OpVariable %_ptr_Private_int Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %x_1 = OpVariable %_ptr_Private_v4float Private %12
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %18 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %23 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %18
+ %21 = OpLabel
+ %22 = OpLoad %int %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %23
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %27 = OpLabel
+ %28 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %18
+ %30 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %33 = OpLoad %uint %tint_symbol
+ %32 = OpBitcast %int %33
+ OpStore %x_4 %32
+ %34 = OpFunctionCall %void %main_1
+ %36 = OpLoad %v4float %x_1
+ %37 = OpCompositeConstruct %main_out %36
+ %35 = OpFunctionCall %void %tint_symbol_3 %37
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.wgsl
new file mode 100644
index 0000000..44937db
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> x_4 : i32;
+
+var<private> x_1 : vec4<f32>;
+
+fn main_1() {
+ let x_14 : ptr<private, i32> = &(x_4);
+ let x_2 : i32 = *(x_14);
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_1_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(vertex_index)]] x_4_param : u32) -> main_out {
+ x_4 = bitcast<i32>(x_4_param);
+ main_1();
+ return main_out(x_1);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm
new file mode 100644
index 0000000..17bd36d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm
@@ -0,0 +1,27 @@
+; Test: SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %gl_Position %gl_VertexIndex
+OpDecorate %gl_Position BuiltIn Position
+OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_VertexIndex = OpVariable %_ptr_Input_int Input
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%13 = OpLabel
+%2 = OpLoad %int %gl_VertexIndex
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.hlsl
new file mode 100644
index 0000000..8f123562
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static int x_4 = 0;
+static float4 x_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const int x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_VertexID;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = asint(x_4_param);
+ main_1();
+ const main_out tint_symbol_3 = {x_1};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.msl
new file mode 100644
index 0000000..884397d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 [[position]];
+};
+
+void main_1(thread int* const tint_symbol_5) {
+ int const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[vertex_id]]) {
+ thread int tint_symbol_6 = 0;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = as_type<int>(x_4_param);
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.x_1_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.x_1_1=tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.spvasm
new file mode 100644
index 0000000..6416131
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn VertexIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %int = OpTypeInt 32 1
+%_ptr_Private_int = OpTypePointer Private %int
+ %8 = OpConstantNull %int
+ %x_4 = OpVariable %_ptr_Private_int Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %x_1 = OpVariable %_ptr_Private_v4float Private %12
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %18 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %23 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %18
+ %21 = OpLabel
+ %22 = OpLoad %int %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %23
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %27 = OpLabel
+ %28 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %18
+ %30 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %33 = OpLoad %uint %tint_symbol
+ %32 = OpBitcast %int %33
+ OpStore %x_4 %32
+ %34 = OpFunctionCall %void %main_1
+ %36 = OpLoad %v4float %x_1
+ %37 = OpCompositeConstruct %main_out %36
+ %35 = OpFunctionCall %void %tint_symbol_3 %37
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.wgsl
new file mode 100644
index 0000000..43d88d3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> x_4 : i32;
+
+var<private> x_1 : vec4<f32>;
+
+fn main_1() {
+ let x_2 : i32 = x_4;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_1_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(vertex_index)]] x_4_param : u32) -> main_out {
+ x_4 = bitcast<i32>(x_4_param);
+ main_1();
+ return main_out(x_1);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm
new file mode 100644
index 0000000..0848db7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 15
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %gl_Position %gl_VertexIndex
+OpDecorate %gl_Position BuiltIn Position
+OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_VertexIndex = OpVariable %_ptr_Input_uint Input
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%13 = OpLabel
+%14 = OpAccessChain %_ptr_Input_uint %gl_VertexIndex
+%2 = OpLoad %uint %14
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..918354f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint x_4 = 0u;
+static float4 x_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const uint x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_VertexID;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = x_4_param;
+ main_1();
+ const main_out tint_symbol_3 = {x_1};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..3c270f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 [[position]];
+};
+
+void main_1(thread uint* const tint_symbol_5) {
+ uint const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[vertex_id]]) {
+ thread uint tint_symbol_6 = 0u;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = x_4_param;
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.x_1_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.x_1_1=tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..7fb3bc7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn VertexIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %8 = OpConstantNull %uint
+ %x_4 = OpVariable %_ptr_Private_uint Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %x_1 = OpVariable %_ptr_Private_v4float Private %12
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %22 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ %21 = OpLoad %uint %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %22
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %26 = OpLabel
+ %27 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %29 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %31 = OpLoad %uint %tint_symbol
+ OpStore %x_4 %31
+ %32 = OpFunctionCall %void %main_1
+ %34 = OpLoad %v4float %x_1
+ %35 = OpCompositeConstruct %main_out %34
+ %33 = OpFunctionCall %void %tint_symbol_3 %35
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..ef5bf46
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> x_4 : u32;
+
+var<private> x_1 : vec4<f32>;
+
+fn main_1() {
+ let x_2 : u32 = x_4;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_1_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(vertex_index)]] x_4_param : u32) -> main_out {
+ x_4 = x_4_param;
+ main_1();
+ return main_out(x_1);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm
new file mode 100644
index 0000000..3aabec6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 15
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %gl_Position %gl_VertexIndex
+OpDecorate %gl_Position BuiltIn Position
+OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_VertexIndex = OpVariable %_ptr_Input_uint Input
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%13 = OpLabel
+%14 = OpCopyObject %_ptr_Input_uint %gl_VertexIndex
+%2 = OpLoad %uint %14
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.hlsl
new file mode 100644
index 0000000..918354f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint x_4 = 0u;
+static float4 x_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const uint x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_VertexID;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = x_4_param;
+ main_1();
+ const main_out tint_symbol_3 = {x_1};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.msl
new file mode 100644
index 0000000..3c270f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 [[position]];
+};
+
+void main_1(thread uint* const tint_symbol_5) {
+ uint const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[vertex_id]]) {
+ thread uint tint_symbol_6 = 0u;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = x_4_param;
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.x_1_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.x_1_1=tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.spvasm
new file mode 100644
index 0000000..7fb3bc7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn VertexIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %8 = OpConstantNull %uint
+ %x_4 = OpVariable %_ptr_Private_uint Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %x_1 = OpVariable %_ptr_Private_v4float Private %12
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %22 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ %21 = OpLoad %uint %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %22
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %26 = OpLabel
+ %27 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %29 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %31 = OpLoad %uint %tint_symbol
+ OpStore %x_4 %31
+ %32 = OpFunctionCall %void %main_1
+ %34 = OpLoad %v4float %x_1
+ %35 = OpCompositeConstruct %main_out %34
+ %33 = OpFunctionCall %void %tint_symbol_3 %35
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.wgsl
new file mode 100644
index 0000000..cf6e07a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> x_4 : u32;
+
+var<private> x_1 : vec4<f32>;
+
+fn main_1() {
+ let x_14 : ptr<private, u32> = &(x_4);
+ let x_2 : u32 = *(x_14);
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_1_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(vertex_index)]] x_4_param : u32) -> main_out {
+ x_4 = x_4_param;
+ main_1();
+ return main_out(x_1);
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm
new file mode 100644
index 0000000..8af2129
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm
@@ -0,0 +1,27 @@
+; Test: SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %3 "main" %gl_Position %gl_VertexIndex
+OpDecorate %gl_Position BuiltIn Position
+OpDecorate %gl_VertexIndex BuiltIn VertexIndex
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Input_uint = OpTypePointer Input %uint
+%gl_VertexIndex = OpVariable %_ptr_Input_uint Input
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%3 = OpFunction %void None %6
+%13 = OpLabel
+%2 = OpLoad %uint %gl_VertexIndex
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.hlsl
new file mode 100644
index 0000000..918354f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint x_4 = 0u;
+static float4 x_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ const uint x_2 = x_4;
+ return;
+}
+
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_1 {
+ uint x_4_param : SV_VertexID;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 : SV_Position;
+};
+
+tint_symbol_2 main(tint_symbol_1 tint_symbol) {
+ const uint x_4_param = tint_symbol.x_4_param;
+ x_4 = x_4_param;
+ main_1();
+ const main_out tint_symbol_3 = {x_1};
+ const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.msl
new file mode 100644
index 0000000..3c270f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_1_1;
+};
+struct tint_symbol_2 {
+ float4 x_1_1 [[position]];
+};
+
+void main_1(thread uint* const tint_symbol_5) {
+ uint const x_2 = *(tint_symbol_5);
+ return;
+}
+
+vertex tint_symbol_2 tint_symbol(uint x_4_param [[vertex_id]]) {
+ thread uint tint_symbol_6 = 0u;
+ thread float4 tint_symbol_7 = 0.0f;
+ tint_symbol_6 = x_4_param;
+ main_1(&(tint_symbol_6));
+ main_out const tint_symbol_3 = {.x_1_1=tint_symbol_7};
+ tint_symbol_2 const tint_symbol_4 = {.x_1_1=tint_symbol_3.x_1_1};
+ return tint_symbol_4;
+}
+
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.spvasm
new file mode 100644
index 0000000..7fb3bc7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_4 "x_4"
+ OpName %x_1 "x_1"
+ OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_1_1"
+ OpName %tint_symbol_3 "tint_symbol_3"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol BuiltIn VertexIndex
+ OpDecorate %tint_symbol_2 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %8 = OpConstantNull %uint
+ %x_4 = OpVariable %_ptr_Private_uint Private %8
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %12 = OpConstantNull %v4float
+ %x_1 = OpVariable %_ptr_Private_v4float Private %12
+%_ptr_Input_uint = OpTypePointer Input %uint
+%tint_symbol = OpVariable %_ptr_Input_uint Input
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %17 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %22 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %17
+ %20 = OpLabel
+ %21 = OpLoad %uint %x_4
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_3 = OpFunction %void None %22
+%tint_symbol_1 = OpFunctionParameter %main_out
+ %26 = OpLabel
+ %27 = OpCompositeExtract %v4float %tint_symbol_1 0
+ OpStore %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %17
+ %29 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %31 = OpLoad %uint %tint_symbol
+ OpStore %x_4 %31
+ %32 = OpFunctionCall %void %main_1
+ %34 = OpLoad %v4float %x_1
+ %35 = OpCompositeConstruct %main_out %34
+ %33 = OpFunctionCall %void %tint_symbol_3 %35
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.wgsl
new file mode 100644
index 0000000..ef5bf46
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> x_4 : u32;
+
+var<private> x_1 : vec4<f32>;
+
+fn main_1() {
+ let x_2 : u32 = x_4;
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_1_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main([[builtin(vertex_index)]] x_4_param : u32) -> main_out {
+ x_4 = x_4_param;
+ main_1();
+ return main_out(x_1);
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm
new file mode 100644
index 0000000..52f74d5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranch %30
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6998ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ {
+ for(; false; ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm
new file mode 100644
index 0000000..ecb3bc9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %40 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm
new file mode 100644
index 0000000..e2f70c1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %40 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm
new file mode 100644
index 0000000..ba6d025
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6998ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ {
+ for(; false; ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm
new file mode 100644
index 0000000..bf5da38
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20 40 %40
+%20 = OpLabel
+OpBranch %30
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..7abd8f9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ /* fallthrough */
+ }
+ case 40u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.msl
new file mode 100644
index 0000000..15a5536
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ /* fallthrough */
+ }
+ case 40u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..e591acf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12 40 %13
+ %12 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..6c1a4a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ fallthrough;
+ }
+ case 40u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm
new file mode 100644
index 0000000..e3f3d8d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %40 20 %20
+%20 = OpLabel
+OpBranch %30
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.hlsl
new file mode 100644
index 0000000..bd88cfc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ /* fallthrough */
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.msl
new file mode 100644
index 0000000..5a8b82a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ /* fallthrough */
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.spvasm
new file mode 100644
index 0000000..98443a8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.wgsl
new file mode 100644
index 0000000..0871e80
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ fallthrough;
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm
new file mode 100644
index 0000000..5ab7265
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %20 40 %40
+%20 = OpLabel
+OpBranch %30
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..bb3c3e0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ default: {
+ /* fallthrough */
+ }
+ case 40u: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.msl
new file mode 100644
index 0000000..bdb9c18
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ default: {
+ /* fallthrough */
+ }
+ case 40u: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..2a1a8ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 40 %12
+ %11 = OpLabel
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..c29337c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ default: {
+ fallthrough;
+ }
+ case 40u: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm
new file mode 100644
index 0000000..8d570b3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %99 %30
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm
new file mode 100644
index 0000000..654a3f2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %99
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm
new file mode 100644
index 0000000..7e98172
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm
new file mode 100644
index 0000000..fa4b540
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..b37d337
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.msl
new file mode 100644
index 0000000..9ea19ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..53e2006
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12
+ %12 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..fe32b0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm
new file mode 100644
index 0000000..125457b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %30 20 %20
+%20 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.hlsl
new file mode 100644
index 0000000..b37d337
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.msl
new file mode 100644
index 0000000..9ea19ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.spvasm
new file mode 100644
index 0000000..53e2006
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12
+ %12 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.wgsl
new file mode 100644
index 0000000..fe32b0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm
new file mode 100644
index 0000000..708ee6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %30
+%20 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranchConditional %true %99 %80
+%80 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.hlsl
new file mode 100644
index 0000000..430e5fb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.hlsl
@@ -0,0 +1,23 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ bool guard10 = true;
+ if (false) {
+ guard10 = false;
+ } else {
+ if (guard10) {
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ guard10 = false;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.msl
new file mode 100644
index 0000000..767c027
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool guard10 = true;
+ if (false) {
+ guard10 = false;
+ } else {
+ if (guard10) {
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ guard10 = false;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.spvasm
new file mode 100644
index 0000000..fe77433
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.spvasm
@@ -0,0 +1,62 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %guard10 "guard10"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %13 = OpConstantNull %bool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %guard10 = OpVariable %_ptr_Function_bool Function %13
+ OpStore %guard10 %true
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpStore %guard10 %false
+ OpBranch %15
+ %17 = OpLabel
+ %18 = OpLoad %bool %guard10
+ OpSelectionMerge %19 None
+ OpBranchConditional %18 %20 %19
+ %20 = OpLabel
+ OpSelectionMerge %21 None
+ OpBranchConditional %true %22 %21
+ %22 = OpLabel
+ OpStore %guard10 %false
+ OpBranch %21
+ %21 = OpLabel
+ %23 = OpLoad %bool %guard10
+ OpSelectionMerge %24 None
+ OpBranchConditional %23 %25 %24
+ %25 = OpLabel
+ OpStore %guard10 %false
+ OpBranch %24
+ %24 = OpLabel
+ OpBranch %19
+ %19 = OpLabel
+ OpBranch %15
+ %15 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.wgsl
new file mode 100644
index 0000000..6fd58e4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var guard10 : bool = true;
+ if (false) {
+ guard10 = false;
+ } else {
+ if (guard10) {
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ guard10 = false;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm
new file mode 100644
index 0000000..21b8b87
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %99
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm
new file mode 100644
index 0000000..3cfda24
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %50
+%20 = OpLabel
+OpBranch %99
+%50 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm
new file mode 100644
index 0000000..ca8b853
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %99
+%20 = OpLabel
+OpBranchConditional %true %99 %80
+%80 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.hlsl
new file mode 100644
index 0000000..c15b476
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ bool guard10 = true;
+ if (false) {
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ guard10 = false;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.msl
new file mode 100644
index 0000000..34e2408
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool guard10 = true;
+ if (false) {
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ guard10 = false;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.spvasm
new file mode 100644
index 0000000..7368bda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %guard10 "guard10"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %13 = OpConstantNull %bool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %guard10 = OpVariable %_ptr_Function_bool Function %13
+ OpStore %guard10 %true
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpSelectionMerge %17 None
+ OpBranchConditional %true %18 %17
+ %18 = OpLabel
+ OpStore %guard10 %false
+ OpBranch %17
+ %17 = OpLabel
+ %19 = OpLoad %bool %guard10
+ OpSelectionMerge %20 None
+ OpBranchConditional %19 %21 %20
+ %21 = OpLabel
+ OpStore %guard10 %false
+ OpBranch %20
+ %20 = OpLabel
+ OpBranch %15
+ %15 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.wgsl
new file mode 100644
index 0000000..7d8850b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var guard10 : bool = true;
+ if (false) {
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ guard10 = false;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructHeader.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructHeader.spvasm.expected.msl
new file mode 100644
index 0000000..bb14141
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructHeader.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ {
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructHeader.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructHeader.spvasm.expected.wgsl
new file mode 100644
index 0000000..99f5532
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructHeader.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+
+ continuing {
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructTail.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructTail.spvasm.expected.msl
new file mode 100644
index 0000000..bb14141
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructTail.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ {
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructTail.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructTail.spvasm.expected.wgsl
new file mode 100644
index 0000000..99f5532
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructTail.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+
+ continuing {
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm
new file mode 100644
index 0000000..517ad6c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranchConditional %true %50 %99
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.hlsl
new file mode 100644
index 0000000..56dedb5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.msl
new file mode 100644
index 0000000..11d5e00
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.spvasm
new file mode 100644
index 0000000..21d52a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %21
+ %20 = OpLabel
+ OpBranch %19
+ %21 = OpLabel
+ OpBranch %10
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.wgsl
new file mode 100644
index 0000000..5b862df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm
new file mode 100644
index 0000000..08b6c8f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %99
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.hlsl
new file mode 100644
index 0000000..7fbc796
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ break;
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.msl
new file mode 100644
index 0000000..baeb119
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ break;
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.spvasm
new file mode 100644
index 0000000..d7eea0c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %10
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.wgsl
new file mode 100644
index 0000000..304252c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ break;
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm
new file mode 100644
index 0000000..48e8bb0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %50 None
+OpBranchConditional %true %40 %50
+%40 = OpLabel
+OpBranchConditional %false %99 %50
+%50 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.hlsl
new file mode 100644
index 0000000..9a2183e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ if (false) {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.msl
new file mode 100644
index 0000000..1f53e06
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ if (false) {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.spvasm
new file mode 100644
index 0000000..ca2cb6b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.spvasm
@@ -0,0 +1,56 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpSelectionMerge %21 None
+ OpBranchConditional %false %22 %21
+ %22 = OpLabel
+ OpBranch %10
+ %21 = OpLabel
+ OpBranch %19
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.wgsl
new file mode 100644
index 0000000..edd72ad
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ if (false) {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm
new file mode 100644
index 0000000..3721240
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %50 None
+OpBranchConditional %true %40 %50
+%40 = OpLabel
+OpBranch %99
+%50 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.hlsl
new file mode 100644
index 0000000..c38af3d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.msl
new file mode 100644
index 0000000..8f73d74
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.spvasm
new file mode 100644
index 0000000..f6d8364
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpBranch %10
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.wgsl
new file mode 100644
index 0000000..ff57f2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm
new file mode 100644
index 0000000..6d72984
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %30 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm
new file mode 100644
index 0000000..0ead87b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6998ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ {
+ for(; false; ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm
new file mode 100644
index 0000000..4d34189
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %99 %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.hlsl
new file mode 100644
index 0000000..9f08a4e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ {
+ for(; !(false); ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.msl
new file mode 100644
index 0000000..fc2a957
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.spvasm
new file mode 100644
index 0000000..e406af2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.spvasm
@@ -0,0 +1,43 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.wgsl
new file mode 100644
index 0000000..d089493
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm
new file mode 100644
index 0000000..e4daf38
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %79 None
+OpBranchConditional %true %40 %79
+%40 = OpLabel
+OpBranchConditional %true %80 %79
+%79 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..71e94e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ if (true) {
+ continue;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.msl
new file mode 100644
index 0000000..e5c85e6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ if (true) {
+ continue;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..6553da9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.spvasm
@@ -0,0 +1,56 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpSelectionMerge %21 None
+ OpBranchConditional %true %22 %21
+ %22 = OpLabel
+ OpBranch %11
+ %21 = OpLabel
+ OpBranch %19
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb1bf7c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ if (true) {
+ continue;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm
new file mode 100644
index 0000000..78e2ff5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %79 None
+OpBranchConditional %true %40 %79
+%40 = OpLabel
+OpBranch %80
+%79 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..218e1b3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ continue;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.msl
new file mode 100644
index 0000000..e83d11c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ continue;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..0a750f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpBranch %11
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..dd4e390
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ continue;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm
new file mode 100644
index 0000000..3672e9a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %79 None
+OpSwitch %uint_42 %79 40 %40
+%40 = OpLabel
+OpBranch %80
+%79 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.hlsl
new file mode 100644
index 0000000..59c7c7a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.hlsl
@@ -0,0 +1,25 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ case 40u: {
+ continue;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.msl
new file mode 100644
index 0000000..96c7549
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ case 40u: {
+ continue;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.spvasm
new file mode 100644
index 0000000..db9c97e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %18 None
+ OpSwitch %uint_42 %20 40 %21
+ %21 = OpLabel
+ OpBranch %11
+ %20 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.wgsl
new file mode 100644
index 0000000..1373cbd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ case 40u: {
+ continue;
+ }
+ default: {
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm
new file mode 100644
index 0000000..9164014
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %79 None
+OpSwitch %uint_42 %40 79 %79
+%40 = OpLabel
+OpBranchConditional %true %80 %79
+%79 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.hlsl
new file mode 100644
index 0000000..89ab524
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ default: {
+ if (true) {
+ continue;
+ }
+ break;
+ }
+ case 79u: {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.msl
new file mode 100644
index 0000000..95ee233
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ default: {
+ if (true) {
+ continue;
+ }
+ break;
+ }
+ case 79u: {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.spvasm
new file mode 100644
index 0000000..e3cc1622
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.spvasm
@@ -0,0 +1,59 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_42 = OpConstant %uint 42
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %18 None
+ OpSwitch %uint_42 %20 79 %21
+ %20 = OpLabel
+ OpSelectionMerge %23 None
+ OpBranchConditional %true %24 %23
+ %24 = OpLabel
+ OpBranch %11
+ %23 = OpLabel
+ OpBranch %18
+ %21 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.wgsl
new file mode 100644
index 0000000..6f6fe49
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ default: {
+ if (true) {
+ continue;
+ }
+ }
+ case 79u: {
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm
new file mode 100644
index 0000000..888bd4e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %79 None
+OpSwitch %uint_42 %40 79 %79
+%40 = OpLabel
+OpBranch %80
+%79 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.hlsl
new file mode 100644
index 0000000..260d523
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.hlsl
@@ -0,0 +1,25 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ default: {
+ continue;
+ break;
+ }
+ case 79u: {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.msl
new file mode 100644
index 0000000..88b3e07
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ default: {
+ continue;
+ break;
+ }
+ case 79u: {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.spvasm
new file mode 100644
index 0000000..baeafde
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %18 None
+ OpSwitch %uint_42 %20 79 %21
+ %20 = OpLabel
+ OpBranch %11
+ %21 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.wgsl
new file mode 100644
index 0000000..a419125
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ default: {
+ continue;
+ }
+ case 79u: {
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm
new file mode 100644
index 0000000..abfa552
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm
new file mode 100644
index 0000000..a8ed369
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %50
+%30 = OpLabel
+OpBranch %99
+%50 = OpLabel
+OpBranch %99
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.hlsl
new file mode 100644
index 0000000..57f0f07
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.msl
new file mode 100644
index 0000000..f88292d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.spvasm
new file mode 100644
index 0000000..e19655c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %10
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.wgsl
new file mode 100644
index 0000000..aacd780
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ break;
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm
new file mode 100644
index 0000000..e83f62e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %30
+%20 = OpLabel
+OpBranch %50
+%30 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %60
+%60 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.hlsl
new file mode 100644
index 0000000..6280e0e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ if (true) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.msl
new file mode 100644
index 0000000..ec038a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ if (true) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.spvasm
new file mode 100644
index 0000000..0979ee2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpSelectionMerge %14 None
+ OpBranchConditional %true %15 %14
+ %15 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.wgsl
new file mode 100644
index 0000000..4abd08f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.wgsl
@@ -0,0 +1,14 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ if (true) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm
new file mode 100644
index 0000000..641a00c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %20
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm
new file mode 100644
index 0000000..20eec07
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpSelectionMerge %80 None
+OpBranchConditional %5 %30 %80
+%30 = OpLabel
+OpBranchConditional %true %99 %80
+%80 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.hlsl
new file mode 100644
index 0000000..41886eb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.hlsl
@@ -0,0 +1,23 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ if (true) {
+ break;
+ }
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.msl
new file mode 100644
index 0000000..1a544d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ if (true) {
+ break;
+ }
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.spvasm
new file mode 100644
index 0000000..0831e97
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.spvasm
@@ -0,0 +1,48 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpSelectionMerge %18 None
+ OpBranchConditional %true %19 %18
+ %19 = OpLabel
+ OpBranch %9
+ %18 = OpLabel
+ OpBranch %15
+ %15 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.wgsl
new file mode 100644
index 0000000..0c8d1d8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ if (true) {
+ break;
+ }
+ }
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm
new file mode 100644
index 0000000..3067372
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpSelectionMerge %80 None
+OpBranchConditional %5 %30 %80
+%30 = OpLabel
+OpBranch %99
+%80 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.hlsl
new file mode 100644
index 0000000..ed2ddf8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ break;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.msl
new file mode 100644
index 0000000..e585500
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ break;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.spvasm
new file mode 100644
index 0000000..7da6bfc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpBranch %9
+ %15 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.wgsl
new file mode 100644
index 0000000..7b0b3d3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ break;
+ }
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm
new file mode 100644
index 0000000..ba18439
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.hlsl
new file mode 100644
index 0000000..b37d337
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.msl
new file mode 100644
index 0000000..9ea19ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.spvasm
new file mode 100644
index 0000000..53e2006
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12
+ %12 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.wgsl
new file mode 100644
index 0000000..fe32b0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm
new file mode 100644
index 0000000..3553544
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %30 20 %99
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.hlsl
new file mode 100644
index 0000000..f198b00
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ default: {
+ break;
+ }
+ case 20u: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.msl
new file mode 100644
index 0000000..58c4499
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ default: {
+ break;
+ }
+ case 20u: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.spvasm
new file mode 100644
index 0000000..689eb89
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12
+ %11 = OpLabel
+ OpBranch %9
+ %12 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.wgsl
new file mode 100644
index 0000000..ef47d68
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ default: {
+ }
+ case 20u: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm
new file mode 100644
index 0000000..27341ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %30 20 %20
+%20 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.hlsl
new file mode 100644
index 0000000..b37d337
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.msl
new file mode 100644
index 0000000..9ea19ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.spvasm
new file mode 100644
index 0000000..53e2006
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12
+ %12 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.wgsl
new file mode 100644
index 0000000..fe32b0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm
new file mode 100644
index 0000000..b40a8bc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.hlsl
new file mode 100644
index 0000000..b37d337
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.msl
new file mode 100644
index 0000000..9ea19ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.spvasm
new file mode 100644
index 0000000..53e2006
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12
+ %12 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.wgsl
new file mode 100644
index 0000000..fe32b0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm
new file mode 100644
index 0000000..8caf6ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %20
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm
new file mode 100644
index 0000000..9aa5014
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %99 %20
+%99 = OpLabel
+OpReturn
+%20 = OpLabel
+OpBranch %99
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm
new file mode 100644
index 0000000..f1b8f28
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%15 = OpLabel
+OpReturn
+%20 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm
new file mode 100644
index 0000000..c552ef2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%15 = OpLabel
+OpReturn
+%20 = OpLabel
+OpKill
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.hlsl
new file mode 100644
index 0000000..856a956
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ discard;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.msl
new file mode 100644
index 0000000..f5d3c1b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ discard_fragment();
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.spvasm
new file mode 100644
index 0000000..8b592e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpKill
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.wgsl
new file mode 100644
index 0000000..dfd6d9e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ discard;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm
new file mode 100644
index 0000000..058815d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %99
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.hlsl
new file mode 100644
index 0000000..7fbc796
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ break;
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.msl
new file mode 100644
index 0000000..baeb119
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ break;
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.spvasm
new file mode 100644
index 0000000..d7eea0c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %10
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.wgsl
new file mode 100644
index 0000000..304252c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ break;
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm
new file mode 100644
index 0000000..edd9c3f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranchConditional %true %99 %40
+%40 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..c38af3d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.msl
new file mode 100644
index 0000000..8f73d74
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..f6d8364
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpBranch %10
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..ff57f2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm
new file mode 100644
index 0000000..3fda991
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranchConditional %true %40 %99
+%40 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.hlsl
new file mode 100644
index 0000000..56dedb5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.msl
new file mode 100644
index 0000000..11d5e00
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.spvasm
new file mode 100644
index 0000000..21d52a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %21
+ %20 = OpLabel
+ OpBranch %19
+ %21 = OpLabel
+ OpBranch %10
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.wgsl
new file mode 100644
index 0000000..5b862df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm
new file mode 100644
index 0000000..8d8c84a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranchConditional %true %50 %40
+%40 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..218e1b3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ continue;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.msl
new file mode 100644
index 0000000..e83d11c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ continue;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..0a750f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpBranch %11
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..dd4e390
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ continue;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm
new file mode 100644
index 0000000..7f67ef0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranchConditional %true %40 %50
+%40 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.hlsl
new file mode 100644
index 0000000..b81a2e5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ } else {
+ continue;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.msl
new file mode 100644
index 0000000..44b0a05
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ } else {
+ continue;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.spvasm
new file mode 100644
index 0000000..6ccc679
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %21
+ %20 = OpLabel
+ OpBranch %19
+ %21 = OpLabel
+ OpBranch %11
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.wgsl
new file mode 100644
index 0000000..1f6d3c3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ } else {
+ continue;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm
new file mode 100644
index 0000000..c840e16
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm
@@ -0,0 +1,62 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %49 None
+OpBranchConditional %true %40 %45
+%40 = OpLabel
+OpBranch %49
+%45 = OpLabel
+OpBranch %49
+%49 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.hlsl
new file mode 100644
index 0000000..aca28ce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.msl
new file mode 100644
index 0000000..3d8920a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.spvasm
new file mode 100644
index 0000000..84909b2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpBranch %19
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.wgsl
new file mode 100644
index 0000000..3ce9f4e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm
new file mode 100644
index 0000000..823cbc9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %49 None
+OpBranchConditional %true %40 %49
+%40 = OpLabel
+OpBranch %99
+%49 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.hlsl
new file mode 100644
index 0000000..c38af3d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.msl
new file mode 100644
index 0000000..8f73d74
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.spvasm
new file mode 100644
index 0000000..f6d8364
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpBranch %10
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.wgsl
new file mode 100644
index 0000000..ff57f2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm
new file mode 100644
index 0000000..c74a3e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %49 None
+OpBranchConditional %true %40 %49
+%40 = OpLabel
+OpBranch %50
+%49 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.hlsl
new file mode 100644
index 0000000..218e1b3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ continue;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.msl
new file mode 100644
index 0000000..e83d11c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ continue;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.spvasm
new file mode 100644
index 0000000..0a750f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpBranch %11
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.wgsl
new file mode 100644
index 0000000..dd4e390
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ continue;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm
new file mode 100644
index 0000000..af9c6c4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm
@@ -0,0 +1,62 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %49 None
+OpSwitch %uint_42 %49 40 %40 45 %45
+%40 = OpLabel
+OpBranch %49
+%45 = OpLabel
+OpBranch %49
+%49 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.hlsl
new file mode 100644
index 0000000..514e583
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ case 45u: {
+ break;
+ }
+ case 40u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.msl
new file mode 100644
index 0000000..b6fc2ae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ case 45u: {
+ break;
+ }
+ case 40u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.spvasm
new file mode 100644
index 0000000..e2b50d5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %18 None
+ OpSwitch %uint_42 %20 45 %21 40 %22
+ %21 = OpLabel
+ OpBranch %18
+ %22 = OpLabel
+ OpBranch %18
+ %20 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.wgsl
new file mode 100644
index 0000000..8083282
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ case 45u: {
+ }
+ case 40u: {
+ }
+ default: {
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm
new file mode 100644
index 0000000..76c990b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm
@@ -0,0 +1,62 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %49 None
+OpSwitch %uint_42 %49 40 %40 45 %45
+%40 = OpLabel
+OpBranch %50
+%45 = OpLabel
+OpBranch %49
+%49 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.hlsl
new file mode 100644
index 0000000..969b7d5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ case 45u: {
+ break;
+ }
+ case 40u: {
+ continue;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.msl
new file mode 100644
index 0000000..12d13bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ case 45u: {
+ break;
+ }
+ case 40u: {
+ continue;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.spvasm
new file mode 100644
index 0000000..3501c09
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %18 None
+ OpSwitch %uint_42 %20 45 %21 40 %22
+ %21 = OpLabel
+ OpBranch %18
+ %22 = OpLabel
+ OpBranch %11
+ %20 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.wgsl
new file mode 100644
index 0000000..593d512
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ switch(42u) {
+ case 45u: {
+ }
+ case 40u: {
+ continue;
+ }
+ default: {
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm
new file mode 100644
index 0000000..1e01ba6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm
@@ -0,0 +1,62 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpSelectionMerge %89 None
+OpBranchConditional %true %60 %70
+%89 = OpLabel
+OpBranch %20
+%60 = OpLabel
+OpBranch %89
+%70 = OpLabel
+OpBranch %89
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..b39c5d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ {
+ if (true) {
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.msl
new file mode 100644
index 0000000..a4a4352
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ {
+ if (true) {
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..0ca7bb7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpBranch %19
+ %19 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..6dc2d6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+
+ continuing {
+ if (true) {
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakIf.spvasm.expected.msl
new file mode 100644
index 0000000..7c96331
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakIf.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ {
+ if (true) {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..2af2019
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakIf.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+
+ continuing {
+ if (true) {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakUnless.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakUnless.spvasm.expected.msl
new file mode 100644
index 0000000..bb14141
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakUnless.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ {
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakUnless.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakUnless.spvasm.expected.wgsl
new file mode 100644
index 0000000..99f5532
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakUnless.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+
+ continuing {
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm
new file mode 100644
index 0000000..d09a0c3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %60
+%60 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm
new file mode 100644
index 0000000..9a8f07b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm
new file mode 100644
index 0000000..13ad50c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %99 %30
+%30 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.hlsl
new file mode 100644
index 0000000..53d908c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.msl
new file mode 100644
index 0000000..fc2a957
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.spvasm
new file mode 100644
index 0000000..e406af2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.spvasm
@@ -0,0 +1,43 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.wgsl
new file mode 100644
index 0000000..d089493
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm
new file mode 100644
index 0000000..8e2976e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm
@@ -0,0 +1,64 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpLoopMerge %49 %40 None
+OpBranchConditional %true %35 %49
+%35 = OpLabel
+OpBranch %37
+%37 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %30
+%49 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.hlsl
new file mode 100644
index 0000000..56c69c8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.hlsl
@@ -0,0 +1,22 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ while (true) {
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.msl
new file mode 100644
index 0000000..82f6bba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ while (true) {
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.spvasm
new file mode 100644
index 0000000..60462be
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.spvasm
@@ -0,0 +1,62 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpLoopMerge %19 %20 None
+ OpBranch %21
+ %21 = OpLabel
+ OpSelectionMerge %23 None
+ OpBranchConditional %true %24 %25
+ %24 = OpLabel
+ OpBranch %23
+ %25 = OpLabel
+ OpBranch %19
+ %23 = OpLabel
+ OpBranch %20
+ %20 = OpLabel
+ OpBranch %18
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.wgsl
new file mode 100644
index 0000000..de05e86
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ loop {
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm
new file mode 100644
index 0000000..d5bccbc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm
@@ -0,0 +1,64 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpLoopMerge %49 %40 None
+OpBranchConditional %true %35 %49
+%35 = OpLabel
+OpBranchConditional %false %49 %37
+%37 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %30
+%49 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.hlsl
new file mode 100644
index 0000000..d22165f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.hlsl
@@ -0,0 +1,25 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ while (true) {
+ if (true) {
+ } else {
+ break;
+ }
+ if (false) {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.msl
new file mode 100644
index 0000000..6432e87
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ while (true) {
+ if (true) {
+ } else {
+ break;
+ }
+ if (false) {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.spvasm
new file mode 100644
index 0000000..074475e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 31
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpLoopMerge %19 %20 None
+ OpBranch %21
+ %21 = OpLabel
+ OpSelectionMerge %23 None
+ OpBranchConditional %true %24 %25
+ %24 = OpLabel
+ OpBranch %23
+ %25 = OpLabel
+ OpBranch %19
+ %23 = OpLabel
+ OpSelectionMerge %26 None
+ OpBranchConditional %false %27 %26
+ %27 = OpLabel
+ OpBranch %19
+ %26 = OpLabel
+ OpBranch %20
+ %20 = OpLabel
+ OpBranch %18
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.wgsl
new file mode 100644
index 0000000..d79060f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ loop {
+ if (true) {
+ } else {
+ break;
+ }
+ if (false) {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm
new file mode 100644
index 0000000..35a7812
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm
@@ -0,0 +1,64 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpLoopMerge %49 %40 None
+OpBranchConditional %true %35 %49
+%35 = OpLabel
+OpBranchConditional %false %37 %49
+%37 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %30
+%49 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.hlsl
new file mode 100644
index 0000000..f51bd41
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ while (true) {
+ if (true) {
+ } else {
+ break;
+ }
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.msl
new file mode 100644
index 0000000..8ec3732
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.msl
@@ -0,0 +1,28 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ while (true) {
+ if (true) {
+ } else {
+ break;
+ }
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.spvasm
new file mode 100644
index 0000000..f8d4894
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpLoopMerge %19 %20 None
+ OpBranch %21
+ %21 = OpLabel
+ OpSelectionMerge %23 None
+ OpBranchConditional %true %24 %25
+ %24 = OpLabel
+ OpBranch %23
+ %25 = OpLabel
+ OpBranch %19
+ %23 = OpLabel
+ OpSelectionMerge %26 None
+ OpBranchConditional %false %27 %28
+ %27 = OpLabel
+ OpBranch %26
+ %28 = OpLabel
+ OpBranch %19
+ %26 = OpLabel
+ OpBranch %20
+ %20 = OpLabel
+ OpBranch %18
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.wgsl
new file mode 100644
index 0000000..c39e75b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.wgsl
@@ -0,0 +1,26 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ loop {
+ if (true) {
+ } else {
+ break;
+ }
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm
new file mode 100644
index 0000000..9bcadbc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm
@@ -0,0 +1,64 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpLoopMerge %49 %40 None
+OpBranchConditional %true %35 %49
+%35 = OpLabel
+OpBranch %37
+%37 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranchConditional %false %30 %49
+%49 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.hlsl
new file mode 100644
index 0000000..72d7f4f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ while (true) {
+ if (true) {
+ } else {
+ break;
+ }
+ {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.msl
new file mode 100644
index 0000000..3785f50
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ while (true) {
+ if (true) {
+ } else {
+ break;
+ }
+ {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.wgsl
new file mode 100644
index 0000000..f59ea7d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ loop {
+ if (true) {
+ } else {
+ break;
+ }
+
+ continuing {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm
new file mode 100644
index 0000000..ed99bd2c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.hlsl
new file mode 100644
index 0000000..bf1cd07
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.msl
new file mode 100644
index 0000000..598fdda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.spvasm
new file mode 100644
index 0000000..abe0206
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.wgsl
new file mode 100644
index 0000000..8c64952
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm
new file mode 100644
index 0000000..6970ee6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.hlsl
new file mode 100644
index 0000000..bf1cd07
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.msl
new file mode 100644
index 0000000..598fdda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.spvasm
new file mode 100644
index 0000000..abe0206
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.wgsl
new file mode 100644
index 0000000..8c64952
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm
new file mode 100644
index 0000000..1143fd0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6998ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ {
+ for(; false; ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm
new file mode 100644
index 0000000..97e73c6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm
@@ -0,0 +1,63 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %50 20 %20 50 %50
+%99 = OpLabel
+OpReturn
+%20 = OpLabel
+OpSelectionMerge %49 None
+OpBranchConditional %5 %99 %40
+%40 = OpLabel
+OpBranch %49
+%49 = OpLabel
+OpBranch %99
+%50 = OpLabel
+OpSelectionMerge %79 None
+OpBranchConditional %5 %60 %99
+%60 = OpLabel
+OpBranch %79
+%79 = OpLabel
+OpBranch %99
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..b6dc560
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ break;
+ }
+ break;
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 50u: {
+ if (false) {
+ } else {
+ break;
+ }
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.msl
new file mode 100644
index 0000000..e9200c2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ break;
+ }
+ break;
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 50u: {
+ if (false) {
+ } else {
+ break;
+ }
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..26fad70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12 50 %13
+ %12 = OpLabel
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %16
+ %17 = OpLabel
+ OpBranch %9
+ %16 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpSelectionMerge %18 None
+ OpBranchConditional %false %19 %20
+ %19 = OpLabel
+ OpBranch %18
+ %20 = OpLabel
+ OpBranch %9
+ %18 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..1e8916d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.wgsl
@@ -0,0 +1,26 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ break;
+ }
+ }
+ default: {
+ fallthrough;
+ }
+ case 50u: {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm
new file mode 100644
index 0000000..87bdbc8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %50 20 %20 50 %50
+%99 = OpLabel
+OpReturn
+%20 = OpLabel
+OpSelectionMerge %49 None
+OpBranchConditional %5 %30 %40
+%49 = OpLabel
+OpBranchConditional %5 %99 %50
+%30 = OpLabel
+OpBranch %49
+%40 = OpLabel
+OpBranch %49
+%50 = OpLabel
+OpSelectionMerge %79 None
+OpBranchConditional %5 %60 %70
+%79 = OpLabel
+OpBranch %99
+%60 = OpLabel
+OpBranch %79
+%70 = OpLabel
+OpBranch %79
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..bf4b8f3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ }
+ if (false) {
+ break;
+ }
+ /* fallthrough */
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 50u: {
+ if (false) {
+ }
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.msl
new file mode 100644
index 0000000..7b508c8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ }
+ if (false) {
+ break;
+ }
+ /* fallthrough */
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 50u: {
+ if (false) {
+ }
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..85b1596
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12 50 %13
+ %12 = OpLabel
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %16
+ %17 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpSelectionMerge %18 None
+ OpBranchConditional %false %19 %18
+ %19 = OpLabel
+ OpBranch %9
+ %18 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpSelectionMerge %20 None
+ OpBranchConditional %false %21 %20
+ %21 = OpLabel
+ OpBranch %20
+ %20 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..7013479
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.wgsl
@@ -0,0 +1,27 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ }
+ if (false) {
+ break;
+ }
+ fallthrough;
+ }
+ default: {
+ fallthrough;
+ }
+ case 50u: {
+ if (false) {
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm
new file mode 100644
index 0000000..44fb4d9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %50
+%99 = OpLabel
+OpReturn
+%20 = OpLabel
+OpSelectionMerge %49 None
+OpBranchConditional %5 %30 %40
+%49 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %49
+%40 = OpLabel
+OpBranch %49
+%50 = OpLabel
+OpSelectionMerge %79 None
+OpBranchConditional %5 %60 %70
+%79 = OpLabel
+OpBranch %99
+%60 = OpLabel
+OpBranch %79
+%70 = OpLabel
+OpBranch %79
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.hlsl
new file mode 100644
index 0000000..1739c33
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ if (false) {
+ }
+ } else {
+ if (false) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.msl
new file mode 100644
index 0000000..2384b83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ if (false) {
+ }
+ } else {
+ if (false) {
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.spvasm
new file mode 100644
index 0000000..6704967
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.spvasm
@@ -0,0 +1,46 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %13
+ %12 = OpLabel
+ OpSelectionMerge %14 None
+ OpBranchConditional %false %15 %14
+ %15 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpBranch %11
+ %13 = OpLabel
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %16
+ %17 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.wgsl
new file mode 100644
index 0000000..f60e6ae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ if (false) {
+ }
+ } else {
+ if (false) {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm
new file mode 100644
index 0000000..201a230
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %50 20 %20 50 %50
+%99 = OpLabel
+OpReturn
+%20 = OpLabel
+OpSelectionMerge %49 None
+OpBranchConditional %5 %30 %40
+%49 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %49
+%40 = OpLabel
+OpBranch %49
+%50 = OpLabel
+OpSelectionMerge %79 None
+OpBranchConditional %5 %60 %70
+%79 = OpLabel
+OpBranch %99
+%60 = OpLabel
+OpBranch %79
+%70 = OpLabel
+OpBranch %79
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..9bc5b7f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.hlsl
@@ -0,0 +1,25 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ }
+ break;
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 50u: {
+ if (false) {
+ }
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.msl
new file mode 100644
index 0000000..df4749b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ }
+ break;
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 50u: {
+ if (false) {
+ }
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..602dc8b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.spvasm
@@ -0,0 +1,49 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12 50 %13
+ %12 = OpLabel
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %16
+ %17 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpSelectionMerge %18 None
+ OpBranchConditional %false %19 %18
+ %19 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..fdc8189
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ if (false) {
+ }
+ }
+ default: {
+ fallthrough;
+ }
+ case 50u: {
+ if (false) {
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm
new file mode 100644
index 0000000..104f8e5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%12 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%42 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm
new file mode 100644
index 0000000..f74f0f2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %30
+%30 = OpLabel
+OpReturn
+%20 = OpLabel
+OpBranch %30
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.hlsl
new file mode 100644
index 0000000..b109634
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ if (true) {
+ return;
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.msl
new file mode 100644
index 0000000..04dcab3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ if (true) {
+ return;
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.spvasm
new file mode 100644
index 0000000..021ce3f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpSelectionMerge %14 None
+ OpBranchConditional %true %15 %14
+ %15 = OpLabel
+ OpReturn
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.wgsl
new file mode 100644
index 0000000..a4faff3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ if (true) {
+ return;
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm
new file mode 100644
index 0000000..61a0f7b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %30
+%30 = OpLabel
+OpReturn
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.hlsl
new file mode 100644
index 0000000..7c3b265
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ } else {
+ return;
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.msl
new file mode 100644
index 0000000..3d70851
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ } else {
+ return;
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.spvasm
new file mode 100644
index 0000000..782c4e6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %13
+ %12 = OpLabel
+ OpBranch %11
+ %13 = OpLabel
+ OpReturn
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.wgsl
new file mode 100644
index 0000000..13fa49d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.wgsl
@@ -0,0 +1,14 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ } else {
+ return;
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm
new file mode 100644
index 0000000..92feaa3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20 40 %40 30 %30 50 %50
+%50 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+%40 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %50
+%20 = OpLabel
+OpBranch %40
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.hlsl
new file mode 100644
index 0000000..790a128
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 30u: {
+ /* fallthrough */
+ }
+ case 50u: {
+ break;
+ }
+ case 20u: {
+ /* fallthrough */
+ }
+ case 40u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.msl
new file mode 100644
index 0000000..151be92
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 30u: {
+ /* fallthrough */
+ }
+ case 50u: {
+ break;
+ }
+ case 20u: {
+ /* fallthrough */
+ }
+ case 40u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.spvasm
new file mode 100644
index 0000000..5a7d864
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.spvasm
@@ -0,0 +1,41 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 30 %12 50 %13 20 %14 40 %15
+ %12 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpBranch %9
+ %14 = OpLabel
+ OpBranch %15
+ %15 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.wgsl
new file mode 100644
index 0000000..6e09415
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 30u: {
+ fallthrough;
+ }
+ case 50u: {
+ }
+ case 20u: {
+ fallthrough;
+ }
+ case 40u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm
new file mode 100644
index 0000000..a74bcc1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %80 20 %20 30 %30
+%20 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %30
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..1d87573
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ /* fallthrough */
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 30u: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.msl
new file mode 100644
index 0000000..12098b9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ /* fallthrough */
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 30u: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..222e91c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12 30 %13
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..8da965c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ fallthrough;
+ }
+ default: {
+ fallthrough;
+ }
+ case 30u: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm
new file mode 100644
index 0000000..d6e1cb3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %80 20 %20 30 %30 40 %40
+%80 = OpLabel
+OpBranch %30
+%99 = OpLabel
+OpReturn
+%40 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %40
+%20 = OpLabel
+OpBranch %99
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.hlsl
new file mode 100644
index 0000000..1a011d0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 30u: {
+ /* fallthrough */
+ }
+ case 40u: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.msl
new file mode 100644
index 0000000..98d92c0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 30u: {
+ /* fallthrough */
+ }
+ case 40u: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.spvasm
new file mode 100644
index 0000000..985caf6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.spvasm
@@ -0,0 +1,39 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12 30 %13 40 %14
+ %12 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.wgsl
new file mode 100644
index 0000000..3a77a68
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ }
+ default: {
+ fallthrough;
+ }
+ case 30u: {
+ fallthrough;
+ }
+ case 40u: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm
new file mode 100644
index 0000000..3f26450
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm
@@ -0,0 +1,61 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20 40 %40 30 %30 50 %50
+%99 = OpLabel
+OpReturn
+%20 = OpLabel
+OpBranch %40
+%30 = OpLabel
+OpBranch %50
+%40 = OpLabel
+OpBranch %60
+%50 = OpLabel
+OpBranch %70
+%60 = OpLabel
+OpBranch %99
+%70 = OpLabel
+OpBranch %99
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.hlsl
new file mode 100644
index 0000000..790a128
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 30u: {
+ /* fallthrough */
+ }
+ case 50u: {
+ break;
+ }
+ case 20u: {
+ /* fallthrough */
+ }
+ case 40u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.msl
new file mode 100644
index 0000000..151be92
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 30u: {
+ /* fallthrough */
+ }
+ case 50u: {
+ break;
+ }
+ case 20u: {
+ /* fallthrough */
+ }
+ case 40u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.spvasm
new file mode 100644
index 0000000..5a7d864
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.spvasm
@@ -0,0 +1,41 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 30 %12 50 %13 20 %14 40 %15
+ %12 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpBranch %9
+ %14 = OpLabel
+ OpBranch %15
+ %15 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.wgsl
new file mode 100644
index 0000000..6e09415
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 30u: {
+ fallthrough;
+ }
+ case 50u: {
+ }
+ case 20u: {
+ fallthrough;
+ }
+ case 40u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm
new file mode 100644
index 0000000..ab38e35
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20 30 %30
+%99 = OpLabel
+OpReturn
+%30 = OpLabel
+OpReturn
+%20 = OpLabel
+OpBranch %99
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.hlsl
new file mode 100644
index 0000000..9313bca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.hlsl
@@ -0,0 +1,22 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 30u: {
+ return;
+ break;
+ }
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.msl
new file mode 100644
index 0000000..00308e92
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 30u: {
+ return;
+ break;
+ }
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.spvasm
new file mode 100644
index 0000000..8223142
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 30 %12 20 %13
+ %12 = OpLabel
+ OpReturn
+ %13 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.wgsl
new file mode 100644
index 0000000..b96a786
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 30u: {
+ return;
+ }
+ case 20u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm
new file mode 100644
index 0000000..24a84a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %80 20 %20 30 %30
+%80 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+%30 = OpLabel
+OpReturn
+%20 = OpLabel
+OpBranch %99
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.hlsl
new file mode 100644
index 0000000..9313bca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.hlsl
@@ -0,0 +1,22 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 30u: {
+ return;
+ break;
+ }
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.msl
new file mode 100644
index 0000000..00308e92
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 30u: {
+ return;
+ break;
+ }
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.spvasm
new file mode 100644
index 0000000..8223142
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 30 %12 20 %13
+ %12 = OpLabel
+ OpReturn
+ %13 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.wgsl
new file mode 100644
index 0000000..b96a786
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 30u: {
+ return;
+ }
+ case 20u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm
new file mode 100644
index 0000000..65363f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %30 20 %20 30 %30 40 %40
+%99 = OpLabel
+OpReturn
+%30 = OpLabel
+OpBranch %99
+%20 = OpLabel
+OpBranch %99
+%40 = OpLabel
+OpBranch %99
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.hlsl
new file mode 100644
index 0000000..3e5b1e2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 40u: {
+ break;
+ }
+ case 20u: {
+ break;
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 30u: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.msl
new file mode 100644
index 0000000..ee56619
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 40u: {
+ break;
+ }
+ case 20u: {
+ break;
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 30u: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.spvasm
new file mode 100644
index 0000000..0280026
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.spvasm
@@ -0,0 +1,39 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 40 %12 20 %13 30 %14
+ %12 = OpLabel
+ OpBranch %9
+ %13 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.wgsl
new file mode 100644
index 0000000..df36f07
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 40u: {
+ }
+ case 20u: {
+ }
+ default: {
+ fallthrough;
+ }
+ case 30u: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm
new file mode 100644
index 0000000..42756b2c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+%20 = OpLabel
+OpBranch %99
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm
new file mode 100644
index 0000000..459e5d7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%15 = OpLabel
+OpReturn
+%20 = OpLabel
+OpUnreachable
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm
new file mode 100644
index 0000000..bf62778
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %80
+%80 = OpLabel
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.hlsl
new file mode 100644
index 0000000..9aa4fae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.msl
new file mode 100644
index 0000000..7b33b3f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.wgsl
new file mode 100644
index 0000000..7b2d608
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+
+ continuing {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm
new file mode 100644
index 0000000..25a3624
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %80
+%80 = OpLabel
+OpBranchConditional %5 %99 %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.hlsl
new file mode 100644
index 0000000..c917259
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ {
+ if (false) {
+ break;
+ }
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.msl
new file mode 100644
index 0000000..d43d445
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ {
+ if (false) {
+ break;
+ }
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.wgsl
new file mode 100644
index 0000000..62e60af
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+
+ continuing {
+ if (false) {
+ break;
+ }
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm
new file mode 100644
index 0000000..d5e8410
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.hlsl
new file mode 100644
index 0000000..fca07cb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.msl
new file mode 100644
index 0000000..36e1a7c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.spvasm
new file mode 100644
index 0000000..235dbca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.wgsl
new file mode 100644
index 0000000..8a3597a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm
new file mode 100644
index 0000000..be047b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.hlsl
new file mode 100644
index 0000000..c02c601
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.msl
new file mode 100644
index 0000000..7a859d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.spvasm
new file mode 100644
index 0000000..7c6b9df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %19
+ %18 = OpLabel
+ OpBranch %17
+ %19 = OpLabel
+ OpBranch %11
+ %17 = OpLabel
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.wgsl
new file mode 100644
index 0000000..93701b8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm
new file mode 100644
index 0000000..1aa956e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %99 %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.hlsl
new file mode 100644
index 0000000..fa7b0f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ if (false) {
+ break;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.msl
new file mode 100644
index 0000000..de9516f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ if (false) {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.spvasm
new file mode 100644
index 0000000..2e57d72
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.spvasm
@@ -0,0 +1,49 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %17
+ %18 = OpLabel
+ OpBranch %11
+ %17 = OpLabel
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.wgsl
new file mode 100644
index 0000000..f103a4e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ if (false) {
+ break;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm
new file mode 100644
index 0000000..571f3b2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpSelectionMerge %50 None
+OpBranchConditional %true %40 %50
+%40 = OpLabel
+OpStore %var %uint_3
+OpBranchConditional %false %80 %80
+%50 = OpLabel
+OpStore %var %uint_4
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_5
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_6
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.hlsl
new file mode 100644
index 0000000..6f8deff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (true) {
+ var_1 = 3u;
+ {
+ var_1 = 5u;
+ }
+ continue;
+ }
+ var_1 = 4u;
+ {
+ var_1 = 5u;
+ }
+ }
+ var_1 = 6u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.msl
new file mode 100644
index 0000000..43efbe2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ if (true) {
+ *(tint_symbol_1) = 3u;
+ {
+ *(tint_symbol_1) = 5u;
+ }
+ continue;
+ }
+ *(tint_symbol_1) = 4u;
+ {
+ *(tint_symbol_1) = 5u;
+ }
+ }
+ *(tint_symbol_1) = 6u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.spvasm
new file mode 100644
index 0000000..b0ed067
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 27
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %uint_6 = OpConstant %uint 6
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %18 None
+ OpBranchConditional %true %19 %18
+ %19 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %12
+ %18 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_5
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_6
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.wgsl
new file mode 100644
index 0000000..798257b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (true) {
+ var_1 = 3u;
+ continue;
+ }
+ var_1 = 4u;
+
+ continuing {
+ var_1 = 5u;
+ }
+ }
+ var_1 = 6u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm
new file mode 100644
index 0000000..f26962f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm
@@ -0,0 +1,66 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpSelectionMerge %50 None
+OpBranchConditional %true %40 %50
+%40 = OpLabel
+OpStore %var %uint_3
+OpBranchConditional %false %80 %80
+%50 = OpLabel
+OpStore %var %uint_4
+OpBranch %80
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_6
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.hlsl
new file mode 100644
index 0000000..23aeadb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (true) {
+ var_1 = 3u;
+ continue;
+ }
+ var_1 = 4u;
+ }
+ var_1 = 6u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.msl
new file mode 100644
index 0000000..2df17cc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ if (true) {
+ *(tint_symbol_1) = 3u;
+ continue;
+ }
+ *(tint_symbol_1) = 4u;
+ }
+ *(tint_symbol_1) = 6u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.spvasm
new file mode 100644
index 0000000..fcce539
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_6 = OpConstant %uint 6
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %18 None
+ OpBranchConditional %true %19 %18
+ %19 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %12
+ %18 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_6
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.wgsl
new file mode 100644
index 0000000..8b32d79
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (true) {
+ var_1 = 3u;
+ continue;
+ }
+ var_1 = 4u;
+ }
+ var_1 = 6u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm
new file mode 100644
index 0000000..06f5602
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranchConditional %5 %80 %80
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.hlsl
new file mode 100644
index 0000000..beee82e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.msl
new file mode 100644
index 0000000..58dfda1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.spvasm
new file mode 100644
index 0000000..675d575
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.spvasm
@@ -0,0 +1,46 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.wgsl
new file mode 100644
index 0000000..f238b48
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+
+ continuing {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm
new file mode 100644
index 0000000..9175999
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %80 %80
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.hlsl
new file mode 100644
index 0000000..f67a99b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.msl
new file mode 100644
index 0000000..5b3988b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.spvasm
new file mode 100644
index 0000000..c7340c6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.wgsl
new file mode 100644
index 0000000..94759b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+
+ continuing {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm
new file mode 100644
index 0000000..3ab896b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm
@@ -0,0 +1,70 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpSelectionMerge %79 None
+OpSwitch %uint_42 %79 40 %40 50 %50
+%40 = OpLabel
+OpStore %var %uint_40
+OpBranchConditional %5 %80 %50
+%50 = OpLabel
+OpStore %var %uint_50
+OpBranch %79
+%79 = OpLabel
+OpStore %var %uint_3
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.hlsl
new file mode 100644
index 0000000..dbe01fc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.hlsl
@@ -0,0 +1,39 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 40u;
+ if (false) {
+ {
+ var_1 = 4u;
+ }
+ continue;
+ }
+ /* fallthrough */
+ }
+ case 50u: {
+ var_1 = 50u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 3u;
+ {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.msl
new file mode 100644
index 0000000..6109a63
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.msl
@@ -0,0 +1,42 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ switch(42u) {
+ case 40u: {
+ *(tint_symbol_1) = 40u;
+ if (false) {
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ continue;
+ }
+ /* fallthrough */
+ }
+ case 50u: {
+ *(tint_symbol_1) = 50u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 3u;
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.spvasm
new file mode 100644
index 0000000..6cc516b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_42 = OpConstant %uint 42
+ %uint_40 = OpConstant %uint 40
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_50 = OpConstant %uint 50
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %16 None
+ OpSwitch %uint_42 %18 40 %19 50 %20
+ %19 = OpLabel
+ OpStore %var_1 %uint_40
+ OpSelectionMerge %24 None
+ OpBranchConditional %false %25 %24
+ %25 = OpLabel
+ OpBranch %12
+ %24 = OpLabel
+ OpBranch %20
+ %20 = OpLabel
+ OpStore %var_1 %uint_50
+ OpBranch %16
+ %18 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.wgsl
new file mode 100644
index 0000000..bbcdec3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.wgsl
@@ -0,0 +1,35 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 40u;
+ if (false) {
+ continue;
+ }
+ fallthrough;
+ }
+ case 50u: {
+ var_1 = 50u;
+ }
+ default: {
+ }
+ }
+ var_1 = 3u;
+
+ continuing {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm
new file mode 100644
index 0000000..206bf95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm
@@ -0,0 +1,70 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpSelectionMerge %79 None
+OpSwitch %uint_42 %79 40 %40 50 %50
+%40 = OpLabel
+OpStore %var %uint_40
+OpBranchConditional %5 %50 %80
+%50 = OpLabel
+OpStore %var %uint_50
+OpBranch %79
+%79 = OpLabel
+OpStore %var %uint_3
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.hlsl
new file mode 100644
index 0000000..ab335c3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.hlsl
@@ -0,0 +1,40 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 40u;
+ if (false) {
+ } else {
+ {
+ var_1 = 4u;
+ }
+ continue;
+ }
+ /* fallthrough */
+ }
+ case 50u: {
+ var_1 = 50u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 3u;
+ {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.msl
new file mode 100644
index 0000000..dc94b10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.msl
@@ -0,0 +1,43 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ switch(42u) {
+ case 40u: {
+ *(tint_symbol_1) = 40u;
+ if (false) {
+ } else {
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ continue;
+ }
+ /* fallthrough */
+ }
+ case 50u: {
+ *(tint_symbol_1) = 50u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 3u;
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.spvasm
new file mode 100644
index 0000000..f7d2e83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_42 = OpConstant %uint 42
+ %uint_40 = OpConstant %uint 40
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_50 = OpConstant %uint 50
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %16 None
+ OpSwitch %uint_42 %18 40 %19 50 %20
+ %19 = OpLabel
+ OpStore %var_1 %uint_40
+ OpSelectionMerge %24 None
+ OpBranchConditional %false %25 %26
+ %25 = OpLabel
+ OpBranch %24
+ %26 = OpLabel
+ OpBranch %12
+ %24 = OpLabel
+ OpBranch %20
+ %20 = OpLabel
+ OpStore %var_1 %uint_50
+ OpBranch %16
+ %18 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.wgsl
new file mode 100644
index 0000000..0d15505
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.wgsl
@@ -0,0 +1,36 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 40u;
+ if (false) {
+ } else {
+ continue;
+ }
+ fallthrough;
+ }
+ case 50u: {
+ var_1 = 50u;
+ }
+ default: {
+ }
+ }
+ var_1 = 3u;
+
+ continuing {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm
new file mode 100644
index 0000000..ff3bd87
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm
@@ -0,0 +1,63 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranchConditional %5 %80 %40
+%40 = OpLabel
+OpStore %var %uint_3
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.hlsl
new file mode 100644
index 0000000..9dc00a2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (false) {
+ {
+ var_1 = 4u;
+ }
+ continue;
+ }
+ var_1 = 3u;
+ {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.msl
new file mode 100644
index 0000000..29d5600
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ if (false) {
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ continue;
+ }
+ *(tint_symbol_1) = 3u;
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.spvasm
new file mode 100644
index 0000000..900b645
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %18 None
+ OpBranchConditional %false %19 %18
+ %19 = OpLabel
+ OpBranch %12
+ %18 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.wgsl
new file mode 100644
index 0000000..1ec7161
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (false) {
+ continue;
+ }
+ var_1 = 3u;
+
+ continuing {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm
new file mode 100644
index 0000000..fae3534
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm
@@ -0,0 +1,63 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranchConditional %5 %40 %80
+%40 = OpLabel
+OpStore %var %uint_3
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.hlsl
new file mode 100644
index 0000000..b460af9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (false) {
+ } else {
+ {
+ var_1 = 4u;
+ }
+ continue;
+ }
+ var_1 = 3u;
+ {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.msl
new file mode 100644
index 0000000..b87c418
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ if (false) {
+ } else {
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ continue;
+ }
+ *(tint_symbol_1) = 3u;
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.spvasm
new file mode 100644
index 0000000..699222b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 27
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %18 None
+ OpBranchConditional %false %19 %20
+ %19 = OpLabel
+ OpBranch %18
+ %20 = OpLabel
+ OpBranch %12
+ %18 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.wgsl
new file mode 100644
index 0000000..7d49a90
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (false) {
+ } else {
+ continue;
+ }
+ var_1 = 3u;
+
+ continuing {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm
new file mode 100644
index 0000000..976f625
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpSelectionMerge %50 None
+OpBranchConditional %true %40 %50
+%40 = OpLabel
+OpStore %var %uint_3
+OpBranchConditional %false %80 %50
+%50 = OpLabel
+OpStore %var %uint_4
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_5
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_6
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.hlsl
new file mode 100644
index 0000000..df6c944
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (true) {
+ var_1 = 3u;
+ if (false) {
+ {
+ var_1 = 5u;
+ }
+ continue;
+ }
+ }
+ var_1 = 4u;
+ {
+ var_1 = 5u;
+ }
+ }
+ var_1 = 6u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.msl
new file mode 100644
index 0000000..7ccdd87
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.msl
@@ -0,0 +1,32 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ if (true) {
+ *(tint_symbol_1) = 3u;
+ if (false) {
+ {
+ *(tint_symbol_1) = 5u;
+ }
+ continue;
+ }
+ }
+ *(tint_symbol_1) = 4u;
+ {
+ *(tint_symbol_1) = 5u;
+ }
+ }
+ *(tint_symbol_1) = 6u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.spvasm
new file mode 100644
index 0000000..5d84afa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.spvasm
@@ -0,0 +1,63 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %uint_3 = OpConstant %uint 3
+ %false = OpConstantFalse %bool
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %uint_6 = OpConstant %uint 6
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %18 None
+ OpBranchConditional %true %19 %18
+ %19 = OpLabel
+ OpStore %var_1 %uint_3
+ OpSelectionMerge %22 None
+ OpBranchConditional %false %23 %22
+ %23 = OpLabel
+ OpBranch %12
+ %22 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_5
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_6
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.wgsl
new file mode 100644
index 0000000..243ee9f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.wgsl
@@ -0,0 +1,27 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (true) {
+ var_1 = 3u;
+ if (false) {
+ continue;
+ }
+ }
+ var_1 = 4u;
+
+ continuing {
+ var_1 = 5u;
+ }
+ }
+ var_1 = 6u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm
new file mode 100644
index 0000000..f316ebf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpSelectionMerge %50 None
+OpBranchConditional %true %40 %50
+%40 = OpLabel
+OpStore %var %uint_3
+OpBranchConditional %false %50 %80
+%50 = OpLabel
+OpStore %var %uint_4
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_5
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_6
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.hlsl
new file mode 100644
index 0000000..c33fba8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (true) {
+ var_1 = 3u;
+ if (false) {
+ } else {
+ {
+ var_1 = 5u;
+ }
+ continue;
+ }
+ }
+ var_1 = 4u;
+ {
+ var_1 = 5u;
+ }
+ }
+ var_1 = 6u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.msl
new file mode 100644
index 0000000..2cf4fe7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ if (true) {
+ *(tint_symbol_1) = 3u;
+ if (false) {
+ } else {
+ {
+ *(tint_symbol_1) = 5u;
+ }
+ continue;
+ }
+ }
+ *(tint_symbol_1) = 4u;
+ {
+ *(tint_symbol_1) = 5u;
+ }
+ }
+ *(tint_symbol_1) = 6u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.spvasm
new file mode 100644
index 0000000..e0c9b64
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.spvasm
@@ -0,0 +1,65 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 31
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %uint_3 = OpConstant %uint 3
+ %false = OpConstantFalse %bool
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %uint_6 = OpConstant %uint 6
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %18 None
+ OpBranchConditional %true %19 %18
+ %19 = OpLabel
+ OpStore %var_1 %uint_3
+ OpSelectionMerge %22 None
+ OpBranchConditional %false %23 %24
+ %23 = OpLabel
+ OpBranch %22
+ %24 = OpLabel
+ OpBranch %12
+ %22 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_5
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_6
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.wgsl
new file mode 100644
index 0000000..d9e895c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.wgsl
@@ -0,0 +1,28 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (true) {
+ var_1 = 3u;
+ if (false) {
+ } else {
+ continue;
+ }
+ }
+ var_1 = 4u;
+
+ continuing {
+ var_1 = 5u;
+ }
+ }
+ var_1 = 6u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm
new file mode 100644
index 0000000..0560ea2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20 30 %30
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranchConditional %5 %30 %30
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.hlsl
new file mode 100644
index 0000000..e0369bc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.hlsl
@@ -0,0 +1,25 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ /* fallthrough */
+ }
+ case 30u: {
+ var_1 = 30u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.msl
new file mode 100644
index 0000000..38398b8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.msl
@@ -0,0 +1,28 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ /* fallthrough */
+ }
+ case 30u: {
+ *(tint_symbol_1) = 30u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.spvasm
new file mode 100644
index 0000000..94fbf17
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_20 = OpConstant %uint 20
+ %uint_30 = OpConstant %uint 30
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 20 %13 30 %14
+ %13 = OpLabel
+ OpStore %var_1 %uint_20
+ OpBranch %14
+ %14 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.wgsl
new file mode 100644
index 0000000..af1f3f9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ fallthrough;
+ }
+ case 30u: {
+ var_1 = 30u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm
new file mode 100644
index 0000000..449eea5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpBranchConditional %5 %99 %99
+%99 = OpLabel
+OpStore %var %uint_2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.hlsl
new file mode 100644
index 0000000..8f48fc5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ var_1 = 2u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.msl
new file mode 100644
index 0000000..6c622f5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.spvasm
new file mode 100644
index 0000000..8d04cde
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.wgsl
new file mode 100644
index 0000000..7201e50
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ var_1 = 2u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm
new file mode 100644
index 0000000..df99edb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpSelectionMerge %99 None
+OpBranchConditional %5 %99 %99
+%20 = OpLabel
+OpStore %var %uint_1
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.hlsl
new file mode 100644
index 0000000..e96888a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ if (false) {
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.msl
new file mode 100644
index 0000000..12e68ab
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ if (false) {
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.spvasm
new file mode 100644
index 0000000..9a0ac9d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpSelectionMerge %12 None
+ OpBranchConditional %false %13 %12
+ %13 = OpLabel
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.wgsl
new file mode 100644
index 0000000..d8631ef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.wgsl
@@ -0,0 +1,14 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ if (false) {
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm
new file mode 100644
index 0000000..c2e06a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm
@@ -0,0 +1,66 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %25
+%25 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %true %30 %40
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranchConditional %5 %99 %80
+%40 = OpLabel
+OpStore %var %uint_3
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.hlsl
new file mode 100644
index 0000000..9eee372
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ if (true) {
+ var_1 = 2u;
+ if (false) {
+ break;
+ } else {
+ {
+ var_1 = 4u;
+ }
+ continue;
+ }
+ }
+ var_1 = 3u;
+ {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.msl
new file mode 100644
index 0000000..1ea53a7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ if (true) {
+ *(tint_symbol_1) = 2u;
+ if (false) {
+ break;
+ } else {
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ continue;
+ }
+ }
+ *(tint_symbol_1) = 3u;
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.spvasm
new file mode 100644
index 0000000..2cfcfd1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.spvasm
@@ -0,0 +1,63 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %uint_2 = OpConstant %uint 2
+ %false = OpConstantFalse %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %17 None
+ OpBranchConditional %true %18 %17
+ %18 = OpLabel
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %21 None
+ OpBranchConditional %false %22 %23
+ %22 = OpLabel
+ OpBranch %11
+ %23 = OpLabel
+ OpBranch %12
+ %21 = OpLabel
+ OpBranch %17
+ %17 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.wgsl
new file mode 100644
index 0000000..8912427
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.wgsl
@@ -0,0 +1,28 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ if (true) {
+ var_1 = 2u;
+ if (false) {
+ break;
+ } else {
+ continue;
+ }
+ }
+ var_1 = 3u;
+
+ continuing {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm
new file mode 100644
index 0000000..dfa3f21
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm
@@ -0,0 +1,66 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %25
+%25 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %true %30 %40
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranchConditional %5 %80 %99
+%40 = OpLabel
+OpStore %var %uint_3
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.hlsl
new file mode 100644
index 0000000..2d4e25e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.hlsl
@@ -0,0 +1,30 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ if (true) {
+ var_1 = 2u;
+ if (false) {
+ {
+ var_1 = 4u;
+ }
+ continue;
+ } else {
+ break;
+ }
+ }
+ var_1 = 3u;
+ {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.msl
new file mode 100644
index 0000000..3bfddee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ if (true) {
+ *(tint_symbol_1) = 2u;
+ if (false) {
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ continue;
+ } else {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 3u;
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.spvasm
new file mode 100644
index 0000000..2f9440b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.spvasm
@@ -0,0 +1,63 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %uint_2 = OpConstant %uint 2
+ %false = OpConstantFalse %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %17 None
+ OpBranchConditional %true %18 %17
+ %18 = OpLabel
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %21 None
+ OpBranchConditional %false %22 %23
+ %22 = OpLabel
+ OpBranch %12
+ %23 = OpLabel
+ OpBranch %11
+ %21 = OpLabel
+ OpBranch %17
+ %17 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.wgsl
new file mode 100644
index 0000000..eb40ee1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.wgsl
@@ -0,0 +1,28 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ if (true) {
+ var_1 = 2u;
+ if (false) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ var_1 = 3u;
+
+ continuing {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm
new file mode 100644
index 0000000..0c6bfe3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm
@@ -0,0 +1,63 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranchConditional %5 %99 %40
+%40 = OpLabel
+OpStore %var %uint_3
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.hlsl
new file mode 100644
index 0000000..e0b407e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.hlsl
@@ -0,0 +1,23 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (false) {
+ break;
+ }
+ var_1 = 3u;
+ {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.msl
new file mode 100644
index 0000000..c422f73
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ if (false) {
+ break;
+ }
+ *(tint_symbol_1) = 3u;
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.spvasm
new file mode 100644
index 0000000..57535ab
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %18 None
+ OpBranchConditional %false %19 %18
+ %19 = OpLabel
+ OpBranch %11
+ %18 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.wgsl
new file mode 100644
index 0000000..e4b5505
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (false) {
+ break;
+ }
+ var_1 = 3u;
+
+ continuing {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm
new file mode 100644
index 0000000..9c99887
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm
@@ -0,0 +1,63 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranchConditional %5 %40 %99
+%40 = OpLabel
+OpStore %var %uint_3
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.hlsl
new file mode 100644
index 0000000..c3276ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.hlsl
@@ -0,0 +1,24 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (false) {
+ } else {
+ break;
+ }
+ var_1 = 3u;
+ {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.msl
new file mode 100644
index 0000000..9f98375
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ if (false) {
+ } else {
+ break;
+ }
+ *(tint_symbol_1) = 3u;
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.spvasm
new file mode 100644
index 0000000..d8d4d7f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 27
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %18 None
+ OpBranchConditional %false %19 %20
+ %19 = OpLabel
+ OpBranch %18
+ %20 = OpLabel
+ OpBranch %11
+ %18 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.wgsl
new file mode 100644
index 0000000..745d1a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (false) {
+ } else {
+ break;
+ }
+ var_1 = 3u;
+
+ continuing {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm
new file mode 100644
index 0000000..a8c3596
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranchConditional %5 %99 %99
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.hlsl
new file mode 100644
index 0000000..ced9780
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ break;
+ {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.msl
new file mode 100644
index 0000000..929ba54
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ break;
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.spvasm
new file mode 100644
index 0000000..81947d8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.spvasm
@@ -0,0 +1,46 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpBranch %11
+ %12 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.wgsl
new file mode 100644
index 0000000..40faeef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+ break;
+
+ continuing {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm
new file mode 100644
index 0000000..1b9c9e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %99 %99
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.hlsl
new file mode 100644
index 0000000..fb42491
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ break;
+ {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.msl
new file mode 100644
index 0000000..4f56341
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ break;
+ {
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.spvasm
new file mode 100644
index 0000000..2b2d072
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %11
+ %12 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.wgsl
new file mode 100644
index 0000000..7fd500c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ break;
+
+ continuing {
+ var_1 = 4u;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm
new file mode 100644
index 0000000..cb4a1ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_2
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_3
+OpSelectionMerge %79 None
+OpSwitch %uint_42 %79 40 %40
+%40 = OpLabel
+OpStore %var %uint_4
+OpBranchConditional %true %80 %80
+%79 = OpLabel
+OpStore %var %uint_5
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_6
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.hlsl
new file mode 100644
index 0000000..13896f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.hlsl
@@ -0,0 +1,33 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ while (true) {
+ var_1 = 2u;
+ var_1 = 3u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 4u;
+ {
+ var_1 = 6u;
+ }
+ continue;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 5u;
+ {
+ var_1 = 6u;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.msl
new file mode 100644
index 0000000..b3374cd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ while (true) {
+ *(tint_symbol_1) = 2u;
+ *(tint_symbol_1) = 3u;
+ switch(42u) {
+ case 40u: {
+ *(tint_symbol_1) = 4u;
+ {
+ *(tint_symbol_1) = 6u;
+ }
+ continue;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ {
+ *(tint_symbol_1) = 6u;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.spvasm
new file mode 100644
index 0000000..61aedfb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.spvasm
@@ -0,0 +1,58 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 27
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_42 = OpConstant %uint 42
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %uint_6 = OpConstant %uint 6
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_2
+ OpStore %var_1 %uint_3
+ OpSelectionMerge %16 None
+ OpSwitch %uint_42 %18 40 %19
+ %19 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %12
+ %18 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpStore %var_1 %uint_5
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_6
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.wgsl
new file mode 100644
index 0000000..674013a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ loop {
+ var_1 = 2u;
+ var_1 = 3u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 4u;
+ continue;
+ }
+ default: {
+ }
+ }
+ var_1 = 5u;
+
+ continuing {
+ var_1 = 6u;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm
new file mode 100644
index 0000000..12cb452
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_2
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_3
+OpSelectionMerge %79 None
+OpSwitch %uint_42 %79 40 %40
+%40 = OpLabel
+OpStore %var %uint_40
+OpBranchConditional %5 %79 %80
+%79 = OpLabel
+OpStore %var %uint_6
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_7
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_8
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.hlsl
new file mode 100644
index 0000000..956ef59
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.hlsl
@@ -0,0 +1,36 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ while (true) {
+ var_1 = 2u;
+ var_1 = 3u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 40u;
+ if (false) {
+ } else {
+ {
+ var_1 = 7u;
+ }
+ continue;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 6u;
+ {
+ var_1 = 7u;
+ }
+ }
+ var_1 = 8u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.msl
new file mode 100644
index 0000000..cf4d143
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.msl
@@ -0,0 +1,39 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ while (true) {
+ *(tint_symbol_1) = 2u;
+ *(tint_symbol_1) = 3u;
+ switch(42u) {
+ case 40u: {
+ *(tint_symbol_1) = 40u;
+ if (false) {
+ } else {
+ {
+ *(tint_symbol_1) = 7u;
+ }
+ continue;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 6u;
+ {
+ *(tint_symbol_1) = 7u;
+ }
+ }
+ *(tint_symbol_1) = 8u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.spvasm
new file mode 100644
index 0000000..d14f8c8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_42 = OpConstant %uint 42
+ %uint_40 = OpConstant %uint 40
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_6 = OpConstant %uint 6
+ %uint_7 = OpConstant %uint 7
+ %uint_8 = OpConstant %uint 8
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_2
+ OpStore %var_1 %uint_3
+ OpSelectionMerge %16 None
+ OpSwitch %uint_42 %18 40 %19
+ %19 = OpLabel
+ OpStore %var_1 %uint_40
+ OpSelectionMerge %23 None
+ OpBranchConditional %false %24 %25
+ %24 = OpLabel
+ OpBranch %23
+ %25 = OpLabel
+ OpBranch %12
+ %23 = OpLabel
+ OpBranch %16
+ %18 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpStore %var_1 %uint_6
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_7
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.wgsl
new file mode 100644
index 0000000..e1975e3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ loop {
+ var_1 = 2u;
+ var_1 = 3u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 40u;
+ if (false) {
+ } else {
+ continue;
+ }
+ }
+ default: {
+ }
+ }
+ var_1 = 6u;
+
+ continuing {
+ var_1 = 7u;
+ }
+ }
+ var_1 = 8u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm
new file mode 100644
index 0000000..b31ebf4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_2
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_3
+OpSelectionMerge %79 None
+OpSwitch %uint_42 %79 40 %40
+%40 = OpLabel
+OpStore %var %uint_40
+OpBranchConditional %5 %80 %79
+%79 = OpLabel
+OpStore %var %uint_6
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_7
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_8
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.hlsl
new file mode 100644
index 0000000..08e5ba2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.hlsl
@@ -0,0 +1,35 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ while (true) {
+ var_1 = 2u;
+ var_1 = 3u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 40u;
+ if (false) {
+ {
+ var_1 = 7u;
+ }
+ continue;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 6u;
+ {
+ var_1 = 7u;
+ }
+ }
+ var_1 = 8u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.msl
new file mode 100644
index 0000000..0d344df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.msl
@@ -0,0 +1,38 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ while (true) {
+ *(tint_symbol_1) = 2u;
+ *(tint_symbol_1) = 3u;
+ switch(42u) {
+ case 40u: {
+ *(tint_symbol_1) = 40u;
+ if (false) {
+ {
+ *(tint_symbol_1) = 7u;
+ }
+ continue;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 6u;
+ {
+ *(tint_symbol_1) = 7u;
+ }
+ }
+ *(tint_symbol_1) = 8u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.spvasm
new file mode 100644
index 0000000..19a499d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.spvasm
@@ -0,0 +1,65 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 31
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_42 = OpConstant %uint 42
+ %uint_40 = OpConstant %uint 40
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_6 = OpConstant %uint 6
+ %uint_7 = OpConstant %uint 7
+ %uint_8 = OpConstant %uint 8
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_2
+ OpStore %var_1 %uint_3
+ OpSelectionMerge %16 None
+ OpSwitch %uint_42 %18 40 %19
+ %19 = OpLabel
+ OpStore %var_1 %uint_40
+ OpSelectionMerge %23 None
+ OpBranchConditional %false %24 %23
+ %24 = OpLabel
+ OpBranch %12
+ %23 = OpLabel
+ OpBranch %16
+ %18 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpStore %var_1 %uint_6
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_7
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.wgsl
new file mode 100644
index 0000000..b926d1a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ loop {
+ var_1 = 2u;
+ var_1 = 3u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 40u;
+ if (false) {
+ continue;
+ }
+ }
+ default: {
+ }
+ }
+ var_1 = 6u;
+
+ continuing {
+ var_1 = 7u;
+ }
+ }
+ var_1 = 8u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm
new file mode 100644
index 0000000..7f1d386
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20 30 %30
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranchConditional %5 %99 %30
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.hlsl
new file mode 100644
index 0000000..6096ec8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ if (false) {
+ break;
+ }
+ /* fallthrough */
+ }
+ case 30u: {
+ var_1 = 30u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.msl
new file mode 100644
index 0000000..3360c55
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.msl
@@ -0,0 +1,31 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ if (false) {
+ break;
+ }
+ /* fallthrough */
+ }
+ case 30u: {
+ *(tint_symbol_1) = 30u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.spvasm
new file mode 100644
index 0000000..2d65a6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.spvasm
@@ -0,0 +1,52 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_30 = OpConstant %uint 30
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 20 %13 30 %14
+ %13 = OpLabel
+ OpStore %var_1 %uint_20
+ OpSelectionMerge %18 None
+ OpBranchConditional %false %19 %18
+ %19 = OpLabel
+ OpBranch %10
+ %18 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.wgsl
new file mode 100644
index 0000000..205de3c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.wgsl
@@ -0,0 +1,26 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ if (false) {
+ break;
+ }
+ fallthrough;
+ }
+ case 30u: {
+ var_1 = 30u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm
new file mode 100644
index 0000000..5991963
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20 30 %30
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.hlsl
new file mode 100644
index 0000000..9233203
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ if (false) {
+ } else {
+ break;
+ }
+ /* fallthrough */
+ }
+ case 30u: {
+ var_1 = 30u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.msl
new file mode 100644
index 0000000..c49bf0b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.msl
@@ -0,0 +1,32 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ if (false) {
+ } else {
+ break;
+ }
+ /* fallthrough */
+ }
+ case 30u: {
+ *(tint_symbol_1) = 30u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.spvasm
new file mode 100644
index 0000000..d5913cf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_30 = OpConstant %uint 30
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 20 %13 30 %14
+ %13 = OpLabel
+ OpStore %var_1 %uint_20
+ OpSelectionMerge %18 None
+ OpBranchConditional %false %19 %20
+ %19 = OpLabel
+ OpBranch %18
+ %20 = OpLabel
+ OpBranch %10
+ %18 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.wgsl
new file mode 100644
index 0000000..876e799
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.wgsl
@@ -0,0 +1,27 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ if (false) {
+ } else {
+ break;
+ }
+ fallthrough;
+ }
+ case 30u: {
+ var_1 = 30u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm
new file mode 100644
index 0000000..07e5f1e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranchConditional %5 %99 %30
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_8
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.hlsl
new file mode 100644
index 0000000..46d4baa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.hlsl
@@ -0,0 +1,25 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ if (false) {
+ break;
+ }
+ var_1 = 30u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 8u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.msl
new file mode 100644
index 0000000..c6dd3c8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.msl
@@ -0,0 +1,28 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ if (false) {
+ break;
+ }
+ *(tint_symbol_1) = 30u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 8u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.spvasm
new file mode 100644
index 0000000..270a5b6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.spvasm
@@ -0,0 +1,50 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_30 = OpConstant %uint 30
+ %uint_8 = OpConstant %uint 8
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 20 %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_20
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %17
+ %18 = OpLabel
+ OpBranch %10
+ %17 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.wgsl
new file mode 100644
index 0000000..7b790f5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ if (false) {
+ break;
+ }
+ var_1 = 30u;
+ }
+ default: {
+ }
+ }
+ var_1 = 8u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm
new file mode 100644
index 0000000..960b81e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_8
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.hlsl
new file mode 100644
index 0000000..379755b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ if (false) {
+ } else {
+ break;
+ }
+ var_1 = 30u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 8u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.msl
new file mode 100644
index 0000000..b6e71c2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ if (false) {
+ } else {
+ break;
+ }
+ *(tint_symbol_1) = 30u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 8u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.spvasm
new file mode 100644
index 0000000..426a8c5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.spvasm
@@ -0,0 +1,52 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_30 = OpConstant %uint 30
+ %uint_8 = OpConstant %uint 8
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 20 %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_20
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %19
+ %18 = OpLabel
+ OpBranch %17
+ %19 = OpLabel
+ OpBranch %10
+ %17 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.wgsl
new file mode 100644
index 0000000..d0b6571
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ if (false) {
+ } else {
+ break;
+ }
+ var_1 = 30u;
+ }
+ default: {
+ }
+ }
+ var_1 = 8u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm
new file mode 100644
index 0000000..1e9cf9e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranchConditional %true %99 %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..dc27829
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.msl
new file mode 100644
index 0000000..722311b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..3533650
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.spvasm
@@ -0,0 +1,41 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_20 = OpConstant %uint 20
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 20 %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_20
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..8452e21
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm
new file mode 100644
index 0000000..f2219ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm
@@ -0,0 +1,61 @@
+; Test: SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpStore %var %uint_20
+OpSelectionMerge %50 None
+OpBranchConditional %5 %40 %50
+%40 = OpLabel
+OpStore %var %uint_40
+OpBranchConditional %true %99 %99
+%50 = OpLabel
+OpStore %var %uint_50
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..3b5b5ba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ if (false) {
+ var_1 = 40u;
+ break;
+ }
+ var_1 = 50u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.msl
new file mode 100644
index 0000000..d88cc2b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ if (false) {
+ *(tint_symbol_1) = 40u;
+ break;
+ }
+ *(tint_symbol_1) = 50u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..c451eb0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.spvasm
@@ -0,0 +1,52 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_40 = OpConstant %uint 40
+ %uint_50 = OpConstant %uint 50
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 20 %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_20
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %17
+ %18 = OpLabel
+ OpStore %var_1 %uint_40
+ OpBranch %10
+ %17 = OpLabel
+ OpStore %var_1 %uint_50
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..3ac298c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ if (false) {
+ var_1 = 40u;
+ break;
+ }
+ var_1 = 50u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm
new file mode 100644
index 0000000..fb14007
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_1
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..ede6455
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ {
+ var_1 = 1u;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.msl
new file mode 100644
index 0000000..323585c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ {
+ *(tint_symbol_1) = 1u;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..1946f34
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..a799866
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+
+ continuing {
+ var_1 = 1u;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm
new file mode 100644
index 0000000..24b8aca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %20 None
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..8142347
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ var_1 = 1u;
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.msl
new file mode 100644
index 0000000..e5e10d8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..1a3bdd2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..9aaeb0d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ var_1 = 1u;
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm
new file mode 100644
index 0000000..6e9d1eb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20 30 %30
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.hlsl
new file mode 100644
index 0000000..e0369bc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.hlsl
@@ -0,0 +1,25 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ /* fallthrough */
+ }
+ case 30u: {
+ var_1 = 30u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.msl
new file mode 100644
index 0000000..38398b8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.msl
@@ -0,0 +1,28 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ /* fallthrough */
+ }
+ case 30u: {
+ *(tint_symbol_1) = 30u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.spvasm
new file mode 100644
index 0000000..94fbf17
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_20 = OpConstant %uint 20
+ %uint_30 = OpConstant %uint 30
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 20 %13 30 %14
+ %13 = OpLabel
+ OpStore %var_1 %uint_20
+ OpBranch %14
+ %14 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.wgsl
new file mode 100644
index 0000000..af1f3f9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ fallthrough;
+ }
+ case 30u: {
+ var_1 = 30u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm
new file mode 100644
index 0000000..f149ceb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_Forward.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.hlsl
new file mode 100644
index 0000000..8f48fc5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ var_1 = 2u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.msl
new file mode 100644
index 0000000..6c622f5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.spvasm
new file mode 100644
index 0000000..8d04cde
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.wgsl
new file mode 100644
index 0000000..7201e50
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ var_1 = 2u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm
new file mode 100644
index 0000000..e4c2aa4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %99 %30
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.hlsl
new file mode 100644
index 0000000..eef0417
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ } else {
+ var_1 = 1u;
+ }
+ var_1 = 2u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.msl
new file mode 100644
index 0000000..62705b4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ if (false) {
+ } else {
+ *(tint_symbol_1) = 1u;
+ }
+ *(tint_symbol_1) = 2u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.spvasm
new file mode 100644
index 0000000..98ecfb4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %13
+ %12 = OpLabel
+ OpBranch %11
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_2
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.wgsl
new file mode 100644
index 0000000..6f1ec56
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ } else {
+ var_1 = 1u;
+ }
+ var_1 = 2u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm
new file mode 100644
index 0000000..b498db9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.hlsl
new file mode 100644
index 0000000..f5eb775
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ var_1 = 1u;
+ }
+ var_1 = 2u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.msl
new file mode 100644
index 0000000..ca14976
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ if (false) {
+ *(tint_symbol_1) = 1u;
+ }
+ *(tint_symbol_1) = 2u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.spvasm
new file mode 100644
index 0000000..01aa6d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_2
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.wgsl
new file mode 100644
index 0000000..7ebbcd8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.wgsl
@@ -0,0 +1,14 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ var_1 = 1u;
+ }
+ var_1 = 2u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm
new file mode 100644
index 0000000..3d77f57
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranch %99
+%80 = OpLabel
+OpStore %var %uint_2
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.hlsl
new file mode 100644
index 0000000..5bdbb28
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ var_1 = 1u;
+ break;
+ {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.msl
new file mode 100644
index 0000000..0891fc7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ break;
+ {
+ *(tint_symbol_1) = 2u;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.spvasm
new file mode 100644
index 0000000..33ba905
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb3843e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ var_1 = 1u;
+ break;
+
+ continuing {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm
new file mode 100644
index 0000000..acd21d5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_1
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.hlsl
new file mode 100644
index 0000000..a783e6d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.msl
new file mode 100644
index 0000000..d81b5d4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ {
+ *(tint_symbol_1) = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.wgsl
new file mode 100644
index 0000000..dc5a5c8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+
+ continuing {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm
new file mode 100644
index 0000000..da27b59
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm
@@ -0,0 +1,63 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpSelectionMerge %50 None
+OpBranchConditional %5 %40 %50
+%40 = OpLabel
+OpStore %var %uint_1
+OpBranch %80
+%50 = OpLabel
+OpStore %var %uint_2
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_3
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.hlsl
new file mode 100644
index 0000000..4d787ec2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.hlsl
@@ -0,0 +1,23 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ var_1 = 1u;
+ {
+ var_1 = 3u;
+ }
+ continue;
+ }
+ var_1 = 2u;
+ {
+ var_1 = 3u;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.msl
new file mode 100644
index 0000000..54b32ea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ if (false) {
+ *(tint_symbol_1) = 1u;
+ {
+ *(tint_symbol_1) = 3u;
+ }
+ continue;
+ }
+ *(tint_symbol_1) = 2u;
+ {
+ *(tint_symbol_1) = 3u;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.spvasm
new file mode 100644
index 0000000..ce3dbc4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.spvasm
@@ -0,0 +1,49 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %11
+ %15 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.wgsl
new file mode 100644
index 0000000..0d66f87
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ var_1 = 1u;
+ continue;
+ }
+ var_1 = 2u;
+
+ continuing {
+ var_1 = 3u;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm
new file mode 100644
index 0000000..abbbadb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_2
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_3
+OpSelectionMerge %79 None
+OpSwitch %uint_42 %79 40 %40
+%40 = OpLabel
+OpStore %var %uint_4
+OpBranch %80
+%79 = OpLabel
+OpStore %var %uint_5
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_6
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.hlsl
new file mode 100644
index 0000000..13896f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.hlsl
@@ -0,0 +1,33 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ while (true) {
+ var_1 = 2u;
+ var_1 = 3u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 4u;
+ {
+ var_1 = 6u;
+ }
+ continue;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 5u;
+ {
+ var_1 = 6u;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.msl
new file mode 100644
index 0000000..b3374cd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ while (true) {
+ *(tint_symbol_1) = 2u;
+ *(tint_symbol_1) = 3u;
+ switch(42u) {
+ case 40u: {
+ *(tint_symbol_1) = 4u;
+ {
+ *(tint_symbol_1) = 6u;
+ }
+ continue;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ {
+ *(tint_symbol_1) = 6u;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.spvasm
new file mode 100644
index 0000000..61aedfb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.spvasm
@@ -0,0 +1,58 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 27
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_42 = OpConstant %uint 42
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %uint_6 = OpConstant %uint 6
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_2
+ OpStore %var_1 %uint_3
+ OpSelectionMerge %16 None
+ OpSwitch %uint_42 %18 40 %19
+ %19 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %12
+ %18 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpStore %var_1 %uint_5
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_6
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.wgsl
new file mode 100644
index 0000000..674013a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.wgsl
@@ -0,0 +1,29 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ loop {
+ var_1 = 2u;
+ var_1 = 3u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 4u;
+ continue;
+ }
+ default: {
+ }
+ }
+ var_1 = 5u;
+
+ continuing {
+ var_1 = 6u;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm
new file mode 100644
index 0000000..2a193dd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_2
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.hlsl
new file mode 100644
index 0000000..9ec1452
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ var_1 = 1u;
+ {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.msl
new file mode 100644
index 0000000..7c64f18
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ {
+ *(tint_symbol_1) = 2u;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.spvasm
new file mode 100644
index 0000000..8f8c047
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.wgsl
new file mode 100644
index 0000000..f23ea02
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ var_1 = 1u;
+
+ continuing {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm
new file mode 100644
index 0000000..a40602a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..dc27829
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.msl
new file mode 100644
index 0000000..722311b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..3533650
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.spvasm
@@ -0,0 +1,41 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_20 = OpConstant %uint 20
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 20 %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_20
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..8452e21
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm
new file mode 100644
index 0000000..2664507
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm
@@ -0,0 +1,61 @@
+; Test: SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpStore %var %uint_20
+OpSelectionMerge %50 None
+OpBranchConditional %5 %40 %50
+%40 = OpLabel
+OpStore %var %uint_40
+OpBranch %99
+%50 = OpLabel
+OpStore %var %uint_50
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..3b5b5ba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ if (false) {
+ var_1 = 40u;
+ break;
+ }
+ var_1 = 50u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.msl
new file mode 100644
index 0000000..d88cc2b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ if (false) {
+ *(tint_symbol_1) = 40u;
+ break;
+ }
+ *(tint_symbol_1) = 50u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..c451eb0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.spvasm
@@ -0,0 +1,52 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_40 = OpConstant %uint 40
+ %uint_50 = OpConstant %uint 50
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 20 %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_20
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %17
+ %18 = OpLabel
+ OpStore %var_1 %uint_40
+ OpBranch %10
+ %17 = OpLabel
+ OpStore %var_1 %uint_50
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..3ac298c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ if (false) {
+ var_1 = 40u;
+ break;
+ }
+ var_1 = 50u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm
new file mode 100644
index 0000000..c4f3f83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%6 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%5 = OpLabel
+OpBranch %10
+%10 = OpLabel
+OpLoopMerge %99 %90 None
+OpBranch %20
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %6 %30 %99
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %90
+%90 = OpLabel
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm
new file mode 100644
index 0000000..0526005
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%6 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%5 = OpLabel
+OpBranch %10
+%10 = OpLabel
+OpLoopMerge %99 %90 None
+OpBranch %20
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %6 %30 %90
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %90
+%90 = OpLabel
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.hlsl
new file mode 100644
index 0000000..d31cc7f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ continue;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.msl
new file mode 100644
index 0000000..6ea82c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ continue;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.spvasm
new file mode 100644
index 0000000..8c7bc0c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %11
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.wgsl
new file mode 100644
index 0000000..169951e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ continue;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm
new file mode 100644
index 0000000..30a1bf6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_20 %99 20 %20
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.hlsl
new file mode 100644
index 0000000..ea27551
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.hlsl
@@ -0,0 +1,22 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(20u) {
+ case 20u: {
+ if (false) {
+ } else {
+ break;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.msl
new file mode 100644
index 0000000..1d512d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(20u) {
+ case 20u: {
+ if (false) {
+ } else {
+ break;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.spvasm
new file mode 100644
index 0000000..0d6e7ce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_20 %11 20 %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %9
+ %15 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.wgsl
new file mode 100644
index 0000000..419b2af
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(20u) {
+ case 20u: {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm
new file mode 100644
index 0000000..ff8c2cb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %50
+%20 = OpLabel
+OpStore %var %uint_2
+OpBranch %99
+%50 = OpLabel
+OpStore %var %uint_3
+OpBranchConditional %true %99 %80
+%80 = OpLabel
+OpStore %var %uint_4
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.hlsl
new file mode 100644
index 0000000..700f4dc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ bool guard10 = true;
+ if (false) {
+ var_1 = 2u;
+ guard10 = false;
+ } else {
+ if (guard10) {
+ var_1 = 3u;
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ var_1 = 4u;
+ guard10 = false;
+ }
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.msl
new file mode 100644
index 0000000..58c9960
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.msl
@@ -0,0 +1,31 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ bool guard10 = true;
+ if (false) {
+ *(tint_symbol_1) = 2u;
+ guard10 = false;
+ } else {
+ if (guard10) {
+ *(tint_symbol_1) = 3u;
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ *(tint_symbol_1) = 4u;
+ guard10 = false;
+ }
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.spvasm
new file mode 100644
index 0000000..69248ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %guard10 "guard10"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %14 = OpConstantNull %bool
+ %false = OpConstantFalse %bool
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %guard10 = OpVariable %_ptr_Function_bool Function %14
+ OpStore %var_1 %uint_1
+ OpStore %guard10 %true
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %18
+ %17 = OpLabel
+ OpStore %var_1 %uint_2
+ OpStore %guard10 %false
+ OpBranch %16
+ %18 = OpLabel
+ %20 = OpLoad %bool %guard10
+ OpSelectionMerge %21 None
+ OpBranchConditional %20 %22 %21
+ %22 = OpLabel
+ OpStore %var_1 %uint_3
+ OpSelectionMerge %24 None
+ OpBranchConditional %true %25 %24
+ %25 = OpLabel
+ OpStore %guard10 %false
+ OpBranch %24
+ %24 = OpLabel
+ %26 = OpLoad %bool %guard10
+ OpSelectionMerge %27 None
+ OpBranchConditional %26 %28 %27
+ %28 = OpLabel
+ OpStore %var_1 %uint_4
+ OpStore %guard10 %false
+ OpBranch %27
+ %27 = OpLabel
+ OpBranch %21
+ %21 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f34f3f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.wgsl
@@ -0,0 +1,28 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ var guard10 : bool = true;
+ if (false) {
+ var_1 = 2u;
+ guard10 = false;
+ } else {
+ if (guard10) {
+ var_1 = 3u;
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ var_1 = 4u;
+ guard10 = false;
+ }
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm
new file mode 100644
index 0000000..ff03e76
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm
@@ -0,0 +1,69 @@
+; Test: SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %50
+%20 = OpLabel
+OpStore %var %uint_2
+OpBranchConditional %true %21 %99
+%21 = OpLabel
+OpStore %var %uint_3
+OpBranch %80
+%50 = OpLabel
+OpStore %var %uint_4
+OpBranchConditional %true %99 %51
+%51 = OpLabel
+OpStore %var %uint_5
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_6
+OpBranchConditional %false %81 %99
+%81 = OpLabel
+OpStore %var %uint_7
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_8
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.hlsl
new file mode 100644
index 0000000..2ff2452
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.hlsl
@@ -0,0 +1,44 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ bool guard10 = true;
+ if (false) {
+ var_1 = 2u;
+ if (true) {
+ } else {
+ guard10 = false;
+ }
+ if (guard10) {
+ var_1 = 3u;
+ }
+ } else {
+ if (guard10) {
+ var_1 = 4u;
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ var_1 = 5u;
+ }
+ }
+ }
+ if (guard10) {
+ var_1 = 6u;
+ if (false) {
+ } else {
+ guard10 = false;
+ }
+ if (guard10) {
+ var_1 = 7u;
+ guard10 = false;
+ }
+ }
+ var_1 = 8u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.msl
new file mode 100644
index 0000000..7f66270
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.msl
@@ -0,0 +1,47 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ bool guard10 = true;
+ if (false) {
+ *(tint_symbol_1) = 2u;
+ if (true) {
+ } else {
+ guard10 = false;
+ }
+ if (guard10) {
+ *(tint_symbol_1) = 3u;
+ }
+ } else {
+ if (guard10) {
+ *(tint_symbol_1) = 4u;
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ *(tint_symbol_1) = 5u;
+ }
+ }
+ }
+ if (guard10) {
+ *(tint_symbol_1) = 6u;
+ if (false) {
+ } else {
+ guard10 = false;
+ }
+ if (guard10) {
+ *(tint_symbol_1) = 7u;
+ guard10 = false;
+ }
+ }
+ *(tint_symbol_1) = 8u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.spvasm
new file mode 100644
index 0000000..49de3ea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.spvasm
@@ -0,0 +1,111 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %guard10 "guard10"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %14 = OpConstantNull %bool
+ %false = OpConstantFalse %bool
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %uint_6 = OpConstant %uint 6
+ %uint_7 = OpConstant %uint 7
+ %uint_8 = OpConstant %uint 8
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %guard10 = OpVariable %_ptr_Function_bool Function %14
+ OpStore %var_1 %uint_1
+ OpStore %guard10 %true
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %18
+ %17 = OpLabel
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %20 None
+ OpBranchConditional %true %21 %22
+ %21 = OpLabel
+ OpBranch %20
+ %22 = OpLabel
+ OpStore %guard10 %false
+ OpBranch %20
+ %20 = OpLabel
+ %23 = OpLoad %bool %guard10
+ OpSelectionMerge %24 None
+ OpBranchConditional %23 %25 %24
+ %25 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %24
+ %24 = OpLabel
+ OpBranch %16
+ %18 = OpLabel
+ %27 = OpLoad %bool %guard10
+ OpSelectionMerge %28 None
+ OpBranchConditional %27 %29 %28
+ %29 = OpLabel
+ OpStore %var_1 %uint_4
+ OpSelectionMerge %31 None
+ OpBranchConditional %true %32 %31
+ %32 = OpLabel
+ OpStore %guard10 %false
+ OpBranch %31
+ %31 = OpLabel
+ %33 = OpLoad %bool %guard10
+ OpSelectionMerge %34 None
+ OpBranchConditional %33 %35 %34
+ %35 = OpLabel
+ OpStore %var_1 %uint_5
+ OpBranch %34
+ %34 = OpLabel
+ OpBranch %28
+ %28 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ %37 = OpLoad %bool %guard10
+ OpSelectionMerge %38 None
+ OpBranchConditional %37 %39 %38
+ %39 = OpLabel
+ OpStore %var_1 %uint_6
+ OpSelectionMerge %41 None
+ OpBranchConditional %false %42 %43
+ %42 = OpLabel
+ OpBranch %41
+ %43 = OpLabel
+ OpStore %guard10 %false
+ OpBranch %41
+ %41 = OpLabel
+ %44 = OpLoad %bool %guard10
+ OpSelectionMerge %45 None
+ OpBranchConditional %44 %46 %45
+ %46 = OpLabel
+ OpStore %var_1 %uint_7
+ OpStore %guard10 %false
+ OpBranch %45
+ %45 = OpLabel
+ OpBranch %38
+ %38 = OpLabel
+ OpStore %var_1 %uint_8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.wgsl
new file mode 100644
index 0000000..66666c4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.wgsl
@@ -0,0 +1,44 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ var guard10 : bool = true;
+ if (false) {
+ var_1 = 2u;
+ if (true) {
+ } else {
+ guard10 = false;
+ }
+ if (guard10) {
+ var_1 = 3u;
+ }
+ } else {
+ if (guard10) {
+ var_1 = 4u;
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ var_1 = 5u;
+ }
+ }
+ }
+ if (guard10) {
+ var_1 = 6u;
+ if (false) {
+ } else {
+ guard10 = false;
+ }
+ if (guard10) {
+ var_1 = 7u;
+ guard10 = false;
+ }
+ }
+ var_1 = 8u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm
new file mode 100644
index 0000000..8bcbb0b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %50
+%20 = OpLabel
+OpStore %var %uint_2
+OpBranchConditional %true %99 %30
+%30 = OpLabel
+OpStore %var %uint_3
+OpBranch %99
+%50 = OpLabel
+OpStore %var %uint_4
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.hlsl
new file mode 100644
index 0000000..02ac4d8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.hlsl
@@ -0,0 +1,28 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ bool guard10 = true;
+ if (false) {
+ var_1 = 2u;
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ var_1 = 3u;
+ guard10 = false;
+ }
+ } else {
+ if (guard10) {
+ var_1 = 4u;
+ guard10 = false;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.msl
new file mode 100644
index 0000000..a337efe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.msl
@@ -0,0 +1,31 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ bool guard10 = true;
+ if (false) {
+ *(tint_symbol_1) = 2u;
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ *(tint_symbol_1) = 3u;
+ guard10 = false;
+ }
+ } else {
+ if (guard10) {
+ *(tint_symbol_1) = 4u;
+ guard10 = false;
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.spvasm
new file mode 100644
index 0000000..c20c840
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %guard10 "guard10"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %14 = OpConstantNull %bool
+ %false = OpConstantFalse %bool
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %guard10 = OpVariable %_ptr_Function_bool Function %14
+ OpStore %var_1 %uint_1
+ OpStore %guard10 %true
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %18
+ %17 = OpLabel
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %20 None
+ OpBranchConditional %true %21 %20
+ %21 = OpLabel
+ OpStore %guard10 %false
+ OpBranch %20
+ %20 = OpLabel
+ %22 = OpLoad %bool %guard10
+ OpSelectionMerge %23 None
+ OpBranchConditional %22 %24 %23
+ %24 = OpLabel
+ OpStore %var_1 %uint_3
+ OpStore %guard10 %false
+ OpBranch %23
+ %23 = OpLabel
+ OpBranch %16
+ %18 = OpLabel
+ %26 = OpLoad %bool %guard10
+ OpSelectionMerge %27 None
+ OpBranchConditional %26 %28 %27
+ %28 = OpLabel
+ OpStore %var_1 %uint_4
+ OpStore %guard10 %false
+ OpBranch %27
+ %27 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpStore %var_1 %uint_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.wgsl
new file mode 100644
index 0000000..77150f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.wgsl
@@ -0,0 +1,28 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ var guard10 : bool = true;
+ if (false) {
+ var_1 = 2u;
+ if (true) {
+ guard10 = false;
+ }
+ if (guard10) {
+ var_1 = 3u;
+ guard10 = false;
+ }
+ } else {
+ if (guard10) {
+ var_1 = 4u;
+ guard10 = false;
+ }
+ }
+ var_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm
new file mode 100644
index 0000000..4c03e81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%6 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%5 = OpLabel
+OpBranch %10
+%10 = OpLabel
+OpLoopMerge %99 %90 None
+OpBranch %20
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %6 %99 %30
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %90
+%90 = OpLabel
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.hlsl
new file mode 100644
index 0000000..53d908c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.msl
new file mode 100644
index 0000000..fc2a957
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.spvasm
new file mode 100644
index 0000000..e406af2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.spvasm
@@ -0,0 +1,43 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.wgsl
new file mode 100644
index 0000000..d089493
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm
new file mode 100644
index 0000000..3925c55
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpSelectionMerge %99 None
+OpBranchConditional %5 %80 %30
+%80 = OpLabel
+OpStore %var %uint_3
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranch %80
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.hlsl
new file mode 100644
index 0000000..1daa202
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ if (false) {
+ } else {
+ var_1 = 1u;
+ }
+ if (true) {
+ var_1 = 3u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.msl
new file mode 100644
index 0000000..9c914e2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ if (false) {
+ } else {
+ *(tint_symbol_1) = 1u;
+ }
+ if (true) {
+ *(tint_symbol_1) = 3u;
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.spvasm
new file mode 100644
index 0000000..88d083a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.spvasm
@@ -0,0 +1,50 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_1 = OpConstant %uint 1
+ %true = OpConstantTrue %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpSelectionMerge %12 None
+ OpBranchConditional %false %13 %14
+ %13 = OpLabel
+ OpBranch %12
+ %14 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %17 None
+ OpBranchConditional %true %18 %17
+ %18 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %17
+ %17 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.wgsl
new file mode 100644
index 0000000..51849d6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ if (false) {
+ } else {
+ var_1 = 1u;
+ }
+ if (true) {
+ var_1 = 3u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm
new file mode 100644
index 0000000..7e396bc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserCFGTest_EmitBody_If_Empty.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %99 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm
new file mode 100644
index 0000000..06aa938
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm
@@ -0,0 +1,71 @@
+; Test: SpvParserCFGTest_EmitBody_If_Nest_If.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpSelectionMerge %99 None
+OpBranchConditional %5 %30 %40
+%30 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %39 None
+OpBranchConditional %true %33 %39
+%33 = OpLabel
+OpStore %var %uint_2
+OpBranch %39
+%39 = OpLabel
+OpStore %var %uint_3
+OpBranch %99
+%40 = OpLabel
+OpStore %var %uint_4
+OpSelectionMerge %49 None
+OpBranchConditional %true %49 %43
+%43 = OpLabel
+OpStore %var %uint_5
+OpBranch %49
+%49 = OpLabel
+OpStore %var %uint_6
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.hlsl
new file mode 100644
index 0000000..fb80d51
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ if (false) {
+ var_1 = 1u;
+ if (true) {
+ var_1 = 2u;
+ }
+ var_1 = 3u;
+ } else {
+ var_1 = 4u;
+ if (true) {
+ } else {
+ var_1 = 5u;
+ }
+ var_1 = 6u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.msl
new file mode 100644
index 0000000..2edb037
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ if (false) {
+ *(tint_symbol_1) = 1u;
+ if (true) {
+ *(tint_symbol_1) = 2u;
+ }
+ *(tint_symbol_1) = 3u;
+ } else {
+ *(tint_symbol_1) = 4u;
+ if (true) {
+ } else {
+ *(tint_symbol_1) = 5u;
+ }
+ *(tint_symbol_1) = 6u;
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.spvasm
new file mode 100644
index 0000000..86dd802
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.spvasm
@@ -0,0 +1,65 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 31
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_1 = OpConstant %uint 1
+ %true = OpConstantTrue %bool
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %uint_6 = OpConstant %uint 6
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpSelectionMerge %12 None
+ OpBranchConditional %false %13 %14
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %17 None
+ OpBranchConditional %true %18 %17
+ %18 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %17
+ %17 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %12
+ %14 = OpLabel
+ OpStore %var_1 %uint_4
+ OpSelectionMerge %22 None
+ OpBranchConditional %true %23 %24
+ %23 = OpLabel
+ OpBranch %22
+ %24 = OpLabel
+ OpStore %var_1 %uint_5
+ OpBranch %22
+ %22 = OpLabel
+ OpStore %var_1 %uint_6
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.wgsl
new file mode 100644
index 0000000..3c6a28f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.wgsl
@@ -0,0 +1,26 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ if (false) {
+ var_1 = 1u;
+ if (true) {
+ var_1 = 2u;
+ }
+ var_1 = 3u;
+ } else {
+ var_1 = 4u;
+ if (true) {
+ } else {
+ var_1 = 5u;
+ }
+ var_1 = 6u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm
new file mode 100644
index 0000000..cdc5267
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpSelectionMerge %99 None
+OpBranchConditional %5 %99 %30
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranch %99
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.hlsl
new file mode 100644
index 0000000..e920c30
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ if (false) {
+ } else {
+ var_1 = 1u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.msl
new file mode 100644
index 0000000..afddae1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ if (false) {
+ } else {
+ *(tint_symbol_1) = 1u;
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.spvasm
new file mode 100644
index 0000000..2b5ca6c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_1 = OpConstant %uint 1
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpSelectionMerge %12 None
+ OpBranchConditional %false %13 %14
+ %13 = OpLabel
+ OpBranch %12
+ %14 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.wgsl
new file mode 100644
index 0000000..1af5e0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ if (false) {
+ } else {
+ var_1 = 1u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm
new file mode 100644
index 0000000..efd46aa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_If_Then_Else.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpSelectionMerge %99 None
+OpBranchConditional %5 %30 %40
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranch %99
+%40 = OpLabel
+OpStore %var %uint_2
+OpBranch %99
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.hlsl
new file mode 100644
index 0000000..ef78092
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ if (false) {
+ var_1 = 1u;
+ } else {
+ var_1 = 2u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.msl
new file mode 100644
index 0000000..243de2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ if (false) {
+ *(tint_symbol_1) = 1u;
+ } else {
+ *(tint_symbol_1) = 2u;
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.spvasm
new file mode 100644
index 0000000..91394e3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpSelectionMerge %12 None
+ OpBranchConditional %false %13 %14
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %12
+ %14 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.wgsl
new file mode 100644
index 0000000..180d5b9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ if (false) {
+ var_1 = 1u;
+ } else {
+ var_1 = 2u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm
new file mode 100644
index 0000000..18bce40
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpSelectionMerge %99 None
+OpBranchConditional %5 %30 %40
+%80 = OpLabel
+OpStore %var %uint_3
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranch %80
+%40 = OpLabel
+OpStore %var %uint_2
+OpBranch %80
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.hlsl
new file mode 100644
index 0000000..455b652
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ if (false) {
+ var_1 = 1u;
+ } else {
+ var_1 = 2u;
+ }
+ if (true) {
+ var_1 = 3u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.msl
new file mode 100644
index 0000000..07bb22c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ if (false) {
+ *(tint_symbol_1) = 1u;
+ } else {
+ *(tint_symbol_1) = 2u;
+ }
+ if (true) {
+ *(tint_symbol_1) = 3u;
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.spvasm
new file mode 100644
index 0000000..eaea586
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.spvasm
@@ -0,0 +1,52 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %true = OpConstantTrue %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpSelectionMerge %12 None
+ OpBranchConditional %false %13 %14
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %12
+ %14 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %18 None
+ OpBranchConditional %true %19 %18
+ %19 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %18
+ %18 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.wgsl
new file mode 100644
index 0000000..9d88c7c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ if (false) {
+ var_1 = 1u;
+ } else {
+ var_1 = 2u;
+ }
+ if (true) {
+ var_1 = 3u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm
new file mode 100644
index 0000000..94de7ce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpSelectionMerge %99 None
+OpBranchConditional %5 %30 %99
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranch %99
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.hlsl
new file mode 100644
index 0000000..30825b5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ if (false) {
+ var_1 = 1u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.msl
new file mode 100644
index 0000000..b2f523d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ if (false) {
+ *(tint_symbol_1) = 1u;
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.spvasm
new file mode 100644
index 0000000..25edd8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_1 = OpConstant %uint 1
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpSelectionMerge %12 None
+ OpBranchConditional %false %13 %12
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.wgsl
new file mode 100644
index 0000000..4d979fd9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ if (false) {
+ var_1 = 1u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm
new file mode 100644
index 0000000..d2550ed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpSelectionMerge %99 None
+OpBranchConditional %5 %30 %80
+%80 = OpLabel
+OpStore %var %uint_3
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranch %80
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.hlsl
new file mode 100644
index 0000000..78aa30f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ if (false) {
+ var_1 = 1u;
+ }
+ if (true) {
+ var_1 = 3u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.msl
new file mode 100644
index 0000000..422a895
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ if (false) {
+ *(tint_symbol_1) = 1u;
+ }
+ if (true) {
+ *(tint_symbol_1) = 3u;
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.spvasm
new file mode 100644
index 0000000..18d9d5e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.spvasm
@@ -0,0 +1,48 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_1 = OpConstant %uint 1
+ %true = OpConstantTrue %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpSelectionMerge %12 None
+ OpBranchConditional %false %13 %12
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %16 None
+ OpBranchConditional %true %17 %16
+ %17 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %16
+ %16 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.wgsl
new file mode 100644
index 0000000..d2055a2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ if (false) {
+ var_1 = 1u;
+ }
+ if (true) {
+ var_1 = 3u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm
new file mode 100644
index 0000000..07cc63a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %99
+%20 = OpLabel
+OpKill
+%99 = OpLabel
+OpKill
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..e82ac97
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ discard;
+ }
+ discard;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.msl
new file mode 100644
index 0000000..bfbb6f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ discard_fragment();
+ }
+ discard_fragment();
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..5abbaed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpKill
+ %11 = OpLabel
+ OpKill
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..1da9df0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ discard;
+ }
+ discard;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm
new file mode 100644
index 0000000..85a2d5b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %30
+%30 = OpLabel
+OpKill
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpKill
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..44f3307
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ discard;
+ }
+ discard;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.msl
new file mode 100644
index 0000000..76bdb15
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ discard_fragment();
+ }
+ discard_fragment();
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..1e9c1fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpKill
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpKill
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..7fb5f4f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ discard;
+ }
+ discard;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm
new file mode 100644
index 0000000..bbeb4d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpKill
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.hlsl
new file mode 100644
index 0000000..856a956
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ discard;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.msl
new file mode 100644
index 0000000..f5d3c1b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ discard_fragment();
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.spvasm
new file mode 100644
index 0000000..8b592e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpKill
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.wgsl
new file mode 100644
index 0000000..dfd6d9e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ discard;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm
new file mode 100644
index 0000000..75c08a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm
@@ -0,0 +1,63 @@
+; Test: SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_10
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_20
+OpLoopMerge %99 %90 None
+OpBranchConditional %5 %30 %40
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %90
+%40 = OpLabel
+OpStore %var %uint_40
+OpBranch %90
+%90 = OpLabel
+OpStore %var %uint_90
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_99
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.hlsl
new file mode 100644
index 0000000..da78328
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.hlsl
@@ -0,0 +1,27 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 10u;
+ while (true) {
+ var_1 = 20u;
+ if (false) {
+ var_1 = 30u;
+ {
+ var_1 = 90u;
+ }
+ continue;
+ } else {
+ var_1 = 40u;
+ }
+ {
+ var_1 = 90u;
+ }
+ }
+ var_1 = 99u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.msl
new file mode 100644
index 0000000..6c3b4c4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 10u;
+ while (true) {
+ *(tint_symbol_1) = 20u;
+ if (false) {
+ *(tint_symbol_1) = 30u;
+ {
+ *(tint_symbol_1) = 90u;
+ }
+ continue;
+ } else {
+ *(tint_symbol_1) = 40u;
+ }
+ {
+ *(tint_symbol_1) = 90u;
+ }
+ }
+ *(tint_symbol_1) = 99u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.spvasm
new file mode 100644
index 0000000..6112971
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 27
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_30 = OpConstant %uint 30
+ %uint_40 = OpConstant %uint 40
+ %uint_90 = OpConstant %uint 90
+ %uint_99 = OpConstant %uint 99
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_10
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_20
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %19
+ %18 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %12
+ %19 = OpLabel
+ OpStore %var_1 %uint_40
+ OpBranch %17
+ %17 = OpLabel
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_90
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_99
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.wgsl
new file mode 100644
index 0000000..53006f1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 10u;
+ loop {
+ var_1 = 20u;
+ if (false) {
+ var_1 = 30u;
+ continue;
+ } else {
+ var_1 = 40u;
+ }
+
+ continuing {
+ var_1 = 90u;
+ }
+ }
+ var_1 = 99u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm
new file mode 100644
index 0000000..e75b918
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranch %99
+%80 = OpLabel
+OpStore %var %uint_2
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.hlsl
new file mode 100644
index 0000000..5bdbb28
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ var_1 = 1u;
+ break;
+ {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.msl
new file mode 100644
index 0000000..0891fc7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ break;
+ {
+ *(tint_symbol_1) = 2u;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.spvasm
new file mode 100644
index 0000000..33ba905
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb3843e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ var_1 = 1u;
+ break;
+
+ continuing {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm
new file mode 100644
index 0000000..20922b4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranchConditional %5 %80 %99
+%80 = OpLabel
+OpStore %var %uint_2
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.hlsl
new file mode 100644
index 0000000..c279966
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.msl
new file mode 100644
index 0000000..c26cd2d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ {
+ *(tint_symbol_1) = 2u;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.spvasm
new file mode 100644
index 0000000..ab8127f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.spvasm
@@ -0,0 +1,49 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %18
+ %17 = OpLabel
+ OpBranch %16
+ %18 = OpLabel
+ OpBranch %10
+ %16 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.wgsl
new file mode 100644
index 0000000..68654dd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+
+ continuing {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm
new file mode 100644
index 0000000..d051f5f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranchConditional %5 %70 %99
+%70 = OpLabel
+OpStore %var %uint_3
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_2
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.hlsl
new file mode 100644
index 0000000..3f0228b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ var_1 = 3u;
+ {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.msl
new file mode 100644
index 0000000..d40dfe7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ *(tint_symbol_1) = 3u;
+ {
+ *(tint_symbol_1) = 2u;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.spvasm
new file mode 100644
index 0000000..fb79a99
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %18
+ %17 = OpLabel
+ OpBranch %16
+ %18 = OpLabel
+ OpBranch %10
+ %16 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.wgsl
new file mode 100644
index 0000000..969c912
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ var_1 = 3u;
+
+ continuing {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm
new file mode 100644
index 0000000..8da1da9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranchConditional %5 %99 %80
+%80 = OpLabel
+OpStore %var %uint_2
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.hlsl
new file mode 100644
index 0000000..ec8fddb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ var_1 = 1u;
+ if (false) {
+ break;
+ }
+ {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.msl
new file mode 100644
index 0000000..9b16297
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ if (false) {
+ break;
+ }
+ {
+ *(tint_symbol_1) = 2u;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.spvasm
new file mode 100644
index 0000000..f2da94e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.spvasm
@@ -0,0 +1,47 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %16
+ %17 = OpLabel
+ OpBranch %10
+ %16 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.wgsl
new file mode 100644
index 0000000..530220d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ var_1 = 1u;
+ if (false) {
+ break;
+ }
+
+ continuing {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm
new file mode 100644
index 0000000..617d2a1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_1
+OpBranchConditional %5 %99 %70
+%70 = OpLabel
+OpStore %var %uint_3
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_2
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.hlsl
new file mode 100644
index 0000000..0fa38cb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ var_1 = 1u;
+ if (false) {
+ break;
+ }
+ var_1 = 3u;
+ {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.msl
new file mode 100644
index 0000000..bb370ef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ if (false) {
+ break;
+ }
+ *(tint_symbol_1) = 3u;
+ {
+ *(tint_symbol_1) = 2u;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.spvasm
new file mode 100644
index 0000000..c881b61
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.spvasm
@@ -0,0 +1,49 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_3 = OpConstant %uint 3
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %16
+ %17 = OpLabel
+ OpBranch %10
+ %16 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.wgsl
new file mode 100644
index 0000000..b703346
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ var_1 = 1u;
+ if (false) {
+ break;
+ }
+ var_1 = 3u;
+
+ continuing {
+ var_1 = 2u;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm
new file mode 100644
index 0000000..b789cb9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm
@@ -0,0 +1,59 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_3
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_4
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.hlsl
new file mode 100644
index 0000000..6fa8cc9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.hlsl
@@ -0,0 +1,22 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ var_1 = 2u;
+ {
+ var_1 = 3u;
+ }
+ }
+ var_1 = 4u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.msl
new file mode 100644
index 0000000..a395bdb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ *(tint_symbol_1) = 2u;
+ {
+ *(tint_symbol_1) = 3u;
+ }
+ }
+ *(tint_symbol_1) = 4u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.spvasm
new file mode 100644
index 0000000..22190e0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %18
+ %17 = OpLabel
+ OpBranch %16
+ %18 = OpLabel
+ OpBranch %10
+ %16 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %9
+ %10 = OpLabel
+ OpStore %var_1 %uint_4
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.wgsl
new file mode 100644
index 0000000..604b078
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ var_1 = 2u;
+
+ continuing {
+ var_1 = 3u;
+ }
+ }
+ var_1 = 4u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm
new file mode 100644
index 0000000..36d7fd6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %20 None
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_2
+OpBranchConditional %5 %99 %20
+%99 = OpLabel
+OpStore %var %uint_3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..b6e396b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (false) {
+ break;
+ }
+ }
+ var_1 = 3u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.msl
new file mode 100644
index 0000000..46d558e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ if (false) {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 3u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..31320d4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_3 = OpConstant %uint 3
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpSelectionMerge %18 None
+ OpBranchConditional %false %19 %18
+ %19 = OpLabel
+ OpBranch %11
+ %18 = OpLabel
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_3
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..61c17a1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+ if (false) {
+ break;
+ }
+ }
+ var_1 = 3u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm
new file mode 100644
index 0000000..3d15ac7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm
@@ -0,0 +1,63 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranch %30
+%30 = OpLabel
+OpSelectionMerge %50 None
+OpBranchConditional %5 %40 %50
+%40 = OpLabel
+OpStore %var %uint_1
+OpBranch %80
+%50 = OpLabel
+OpStore %var %uint_2
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_3
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.hlsl
new file mode 100644
index 0000000..4d787ec2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.hlsl
@@ -0,0 +1,23 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ var_1 = 1u;
+ {
+ var_1 = 3u;
+ }
+ continue;
+ }
+ var_1 = 2u;
+ {
+ var_1 = 3u;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.msl
new file mode 100644
index 0000000..54b32ea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ if (false) {
+ *(tint_symbol_1) = 1u;
+ {
+ *(tint_symbol_1) = 3u;
+ }
+ continue;
+ }
+ *(tint_symbol_1) = 2u;
+ {
+ *(tint_symbol_1) = 3u;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.spvasm
new file mode 100644
index 0000000..ce3dbc4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.spvasm
@@ -0,0 +1,49 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %11
+ %15 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.wgsl
new file mode 100644
index 0000000..0d66f87
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ var_1 = 1u;
+ continue;
+ }
+ var_1 = 2u;
+
+ continuing {
+ var_1 = 3u;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm
new file mode 100644
index 0000000..56b2d5c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_Never.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %99 %99
+%80 = OpLabel
+OpStore %var %uint_2
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.hlsl
new file mode 100644
index 0000000..d040ced
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ var_1 = 1u;
+ break;
+ {
+ var_1 = 2u;
+ }
+ }
+ var_1 = 3u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.msl
new file mode 100644
index 0000000..e5e10c1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ break;
+ {
+ *(tint_symbol_1) = 2u;
+ }
+ }
+ *(tint_symbol_1) = 3u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.spvasm
new file mode 100644
index 0000000..fe91b41
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %9
+ %10 = OpLabel
+ OpStore %var_1 %uint_3
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.wgsl
new file mode 100644
index 0000000..dbbeae8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ var_1 = 1u;
+ break;
+
+ continuing {
+ var_1 = 2u;
+ }
+ }
+ var_1 = 3u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm
new file mode 100644
index 0000000..45056eb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %20
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.hlsl
new file mode 100644
index 0000000..b9db322
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.msl
new file mode 100644
index 0000000..ea86c1a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.spvasm
new file mode 100644
index 0000000..b03b091
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.wgsl
new file mode 100644
index 0000000..533da6e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm
new file mode 100644
index 0000000..e79cda5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %99 %20
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.hlsl
new file mode 100644
index 0000000..fe271d8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ if (false) {
+ break;
+ }
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.msl
new file mode 100644
index 0000000..1c7f5e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ if (false) {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.spvasm
new file mode 100644
index 0000000..9fde6f5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.spvasm
@@ -0,0 +1,49 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %17
+ %18 = OpLabel
+ OpBranch %11
+ %17 = OpLabel
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.wgsl
new file mode 100644
index 0000000..a02819e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ if (false) {
+ break;
+ }
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm
new file mode 100644
index 0000000..89bc652
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.hlsl
new file mode 100644
index 0000000..77f5bbc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.msl
new file mode 100644
index 0000000..0544bb1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.spvasm
new file mode 100644
index 0000000..4719efe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %19
+ %18 = OpLabel
+ OpBranch %17
+ %19 = OpLabel
+ OpBranch %11
+ %17 = OpLabel
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.wgsl
new file mode 100644
index 0000000..7f67521
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm
new file mode 100644
index 0000000..5a49c7a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %20 None
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.hlsl
new file mode 100644
index 0000000..b9db322
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.msl
new file mode 100644
index 0000000..ea86c1a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.spvasm
new file mode 100644
index 0000000..b03b091
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.wgsl
new file mode 100644
index 0000000..533da6e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm
new file mode 100644
index 0000000..bcb0665
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm
@@ -0,0 +1,59 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_3
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_4
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.hlsl
new file mode 100644
index 0000000..6fa8cc9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.hlsl
@@ -0,0 +1,22 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ var_1 = 2u;
+ {
+ var_1 = 3u;
+ }
+ }
+ var_1 = 4u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.msl
new file mode 100644
index 0000000..a395bdb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ *(tint_symbol_1) = 2u;
+ {
+ *(tint_symbol_1) = 3u;
+ }
+ }
+ *(tint_symbol_1) = 4u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.spvasm
new file mode 100644
index 0000000..22190e0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %18
+ %17 = OpLabel
+ OpBranch %16
+ %18 = OpLabel
+ OpBranch %10
+ %16 = OpLabel
+ OpStore %var_1 %uint_2
+ OpBranch %11
+ %11 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %9
+ %10 = OpLabel
+ OpStore %var_1 %uint_4
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.wgsl
new file mode 100644
index 0000000..604b078
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ var_1 = 1u;
+ if (false) {
+ } else {
+ break;
+ }
+ var_1 = 2u;
+
+ continuing {
+ var_1 = 3u;
+ }
+ }
+ var_1 = 4u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm
new file mode 100644
index 0000000..5d0dd06
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %50 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranch %50
+%50 = OpLabel
+OpStore %var %uint_3
+OpSelectionMerge %80 None
+OpBranchConditional %true %60 %80
+%60 = OpLabel
+OpStore %var %uint_4
+OpBranch %80
+%80 = OpLabel
+OpStore %var %uint_5
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..ba79b95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.hlsl
@@ -0,0 +1,23 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ {
+ var_1 = 3u;
+ if (true) {
+ var_1 = 4u;
+ }
+ var_1 = 5u;
+ }
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.msl
new file mode 100644
index 0000000..5d8fe8a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ {
+ *(tint_symbol_1) = 3u;
+ if (true) {
+ *(tint_symbol_1) = 4u;
+ }
+ *(tint_symbol_1) = 5u;
+ }
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..4b540e5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 27
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %uint_4 = OpConstant %uint 4
+ %uint_5 = OpConstant %uint 5
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_3
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpStore %var_1 %uint_4
+ OpBranch %19
+ %19 = OpLabel
+ OpStore %var_1 %uint_5
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..a031175
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+
+ continuing {
+ var_1 = 3u;
+ if (true) {
+ var_1 = 4u;
+ }
+ var_1 = 5u;
+ }
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm
new file mode 100644
index 0000000..44f07bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm
@@ -0,0 +1,63 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %50 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranch %50
+%50 = OpLabel
+OpStore %var %uint_3
+OpBranch %60
+%60 = OpLabel
+OpStore %var %uint_4
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.hlsl
new file mode 100644
index 0000000..4553fdc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ {
+ var_1 = 3u;
+ var_1 = 4u;
+ }
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.msl
new file mode 100644
index 0000000..22de66c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ {
+ *(tint_symbol_1) = 3u;
+ *(tint_symbol_1) = 4u;
+ }
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.spvasm
new file mode 100644
index 0000000..7606e95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.spvasm
@@ -0,0 +1,48 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_3
+ OpStore %var_1 %uint_4
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.wgsl
new file mode 100644
index 0000000..4f1ff80
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+
+ continuing {
+ var_1 = 3u;
+ var_1 = 4u;
+ }
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm
new file mode 100644
index 0000000..5532978
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_0
+OpBranch %20
+%20 = OpLabel
+OpStore %var %uint_1
+OpLoopMerge %99 %50 None
+OpBranch %30
+%30 = OpLabel
+OpStore %var %uint_2
+OpBranch %50
+%50 = OpLabel
+OpStore %var %uint_3
+OpBranch %20
+%99 = OpLabel
+OpStore %var %uint_999
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.hlsl
new file mode 100644
index 0000000..f002ff9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 0u;
+ while (true) {
+ var_1 = 1u;
+ var_1 = 2u;
+ {
+ var_1 = 3u;
+ }
+ }
+ var_1 = 999u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.msl
new file mode 100644
index 0000000..b9531c1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ *(tint_symbol_1) = 1u;
+ *(tint_symbol_1) = 2u;
+ {
+ *(tint_symbol_1) = 3u;
+ }
+ }
+ *(tint_symbol_1) = 999u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.spvasm
new file mode 100644
index 0000000..76a5593
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.spvasm
@@ -0,0 +1,46 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_999 = OpConstant %uint 999
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_0
+ OpBranch %10
+ %10 = OpLabel
+ OpLoopMerge %11 %12 None
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_1
+ OpStore %var_1 %uint_2
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %var_1 %uint_3
+ OpBranch %10
+ %11 = OpLabel
+ OpStore %var_1 %uint_999
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.wgsl
new file mode 100644
index 0000000..f5f8f3a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 0u;
+ loop {
+ var_1 = 1u;
+ var_1 = 2u;
+
+ continuing {
+ var_1 = 3u;
+ }
+ }
+ var_1 = 999u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm
new file mode 100644
index 0000000..184c774
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%200 = OpFunction %uint None %14
+%210 = OpLabel
+OpSelectionMerge %299 None
+OpBranchConditional %5 %220 %299
+%220 = OpLabel
+OpReturnValue %uint_2
+%299 = OpLabel
+OpReturnValue %uint_3
+OpFunctionEnd
+%100 = OpFunction %void None %3
+%10 = OpLabel
+%11 = OpFunctionCall %uint %200
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..8164e48
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+uint x_200() {
+ if (false) {
+ return 2u;
+ }
+ return 3u;
+}
+
+void main_1() {
+ const uint x_11 = x_200();
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.msl
new file mode 100644
index 0000000..aa29663
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint x_200() {
+ if (false) {
+ return 2u;
+ }
+ return 3u;
+}
+
+void main_1() {
+ uint const x_11 = x_200();
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..d409cac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.spvasm
@@ -0,0 +1,43 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %5 = OpTypeFunction %uint
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %void = OpTypeVoid
+ %14 = OpTypeFunction %void
+ %x_200 = OpFunction %uint None %5
+ %7 = OpLabel
+ OpSelectionMerge %10 None
+ OpBranchConditional %false %11 %10
+ %11 = OpLabel
+ OpReturnValue %uint_2
+ %10 = OpLabel
+ OpReturnValue %uint_3
+ OpFunctionEnd
+ %main_1 = OpFunction %void None %14
+ %17 = OpLabel
+ %18 = OpFunctionCall %uint %x_200
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %14
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..0923877
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn x_200() -> u32 {
+ if (false) {
+ return 2u;
+ }
+ return 3u;
+}
+
+fn main_1() {
+ let x_11 : u32 = x_200();
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm
new file mode 100644
index 0000000..966da29
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%200 = OpFunction %uint None %14
+%210 = OpLabel
+OpBranch %220
+%220 = OpLabel
+OpLoopMerge %299 %280 None
+OpBranchConditional %5 %230 %230
+%230 = OpLabel
+OpReturnValue %uint_2
+%280 = OpLabel
+OpBranch %220
+%299 = OpLabel
+OpReturnValue %uint_3
+OpFunctionEnd
+%100 = OpFunction %void None %3
+%10 = OpLabel
+%11 = OpFunctionCall %uint %200
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.hlsl
new file mode 100644
index 0000000..62aef67
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+uint x_200() {
+ while (true) {
+ return 2u;
+ }
+ return 3u;
+}
+
+void main_1() {
+ const uint x_11 = x_200();
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.msl
new file mode 100644
index 0000000..b3e4ce1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint x_200() {
+ while (true) {
+ return 2u;
+ }
+ return 3u;
+}
+
+void main_1() {
+ uint const x_11 = x_200();
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.spvasm
new file mode 100644
index 0000000..b2d369d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %5 = OpTypeFunction %uint
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+ %void = OpTypeVoid
+ %14 = OpTypeFunction %void
+ %x_200 = OpFunction %uint None %5
+ %7 = OpLabel
+ OpBranch %8
+ %8 = OpLabel
+ OpLoopMerge %9 %10 None
+ OpBranch %11
+ %11 = OpLabel
+ OpReturnValue %uint_2
+ %10 = OpLabel
+ OpBranch %8
+ %9 = OpLabel
+ OpReturnValue %uint_3
+ OpFunctionEnd
+ %main_1 = OpFunction %void None %14
+ %17 = OpLabel
+ %18 = OpFunctionCall %uint %x_200
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %14
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.wgsl
new file mode 100644
index 0000000..fc4233f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn x_200() -> u32 {
+ loop {
+ return 2u;
+ }
+ return 3u;
+}
+
+fn main_1() {
+ let x_11 : u32 = x_200();
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm
new file mode 100644
index 0000000..b0de0cd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%200 = OpFunction %uint None %14
+%210 = OpLabel
+OpReturnValue %uint_2
+OpFunctionEnd
+%100 = OpFunction %void None %3
+%10 = OpLabel
+%11 = OpFunctionCall %uint %200
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.hlsl
new file mode 100644
index 0000000..3e97fbb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+uint x_200() {
+ return 2u;
+}
+
+void main_1() {
+ const uint x_11 = x_200();
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.msl
new file mode 100644
index 0000000..379405d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint x_200() {
+ return 2u;
+}
+
+void main_1() {
+ uint const x_11 = x_200();
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.spvasm
new file mode 100644
index 0000000..d37a80b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %5 = OpTypeFunction %uint
+ %uint_2 = OpConstant %uint 2
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %x_200 = OpFunction %uint None %5
+ %7 = OpLabel
+ OpReturnValue %uint_2
+ OpFunctionEnd
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %13 = OpFunctionCall %uint %x_200
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.wgsl
new file mode 100644
index 0000000..9aecfcd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn x_200() -> u32 {
+ return 2u;
+}
+
+fn main_1() {
+ let x_11 : u32 = x_200();
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm
new file mode 100644
index 0000000..a81d794
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %99
+%20 = OpLabel
+OpReturn
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..dc451e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ return;
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.msl
new file mode 100644
index 0000000..fb3b83a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ return;
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..9558a9a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpReturn
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..4da92df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ return;
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm
new file mode 100644
index 0000000..e8f8b51
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %30
+%30 = OpLabel
+OpReturn
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..b9dbbea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ return;
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.msl
new file mode 100644
index 0000000..d80c8fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ return;
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..f445af6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpReturn
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..3e1a55f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ return;
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm
new file mode 100644
index 0000000..c32bbbe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm
new file mode 100644
index 0000000..91978cb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %int_42 %99 20 %20 2000000000 %30 -294967296 %40
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranch %99
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %99
+%40 = OpLabel
+OpStore %var %uint_40
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.hlsl
new file mode 100644
index 0000000..594c316
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42) {
+ case -294967296: {
+ var_1 = 40u;
+ break;
+ }
+ case 2000000000: {
+ var_1 = 30u;
+ break;
+ }
+ case 20: {
+ var_1 = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.msl
new file mode 100644
index 0000000..3e10b9f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.msl
@@ -0,0 +1,32 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42) {
+ case -294967296: {
+ *(tint_symbol_1) = 40u;
+ break;
+ }
+ case 2000000000: {
+ *(tint_symbol_1) = 30u;
+ break;
+ }
+ case 20: {
+ *(tint_symbol_1) = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.spvasm
new file mode 100644
index 0000000..c4d6470
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.spvasm
@@ -0,0 +1,50 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %int = OpTypeInt 32 1
+ %int_42 = OpConstant %int 42
+ %uint_40 = OpConstant %uint 40
+ %uint_30 = OpConstant %uint 30
+ %uint_20 = OpConstant %uint 20
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %int_42 %13 -294967296 %14 2000000000 %15 20 %16
+ %14 = OpLabel
+ OpStore %var_1 %uint_40
+ OpBranch %10
+ %15 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %10
+ %16 = OpLabel
+ OpStore %var_1 %uint_20
+ OpBranch %10
+ %13 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.wgsl
new file mode 100644
index 0000000..fb63bf3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42) {
+ case -294967296: {
+ var_1 = 40u;
+ }
+ case 2000000000: {
+ var_1 = 30u;
+ }
+ case 20: {
+ var_1 = 20u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm
new file mode 100644
index 0000000..8a6f62e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20 2000000000 %30 50 %40
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranch %99
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %99
+%40 = OpLabel
+OpStore %var %uint_40
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.hlsl
new file mode 100644
index 0000000..752ebc8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 50u: {
+ var_1 = 40u;
+ break;
+ }
+ case 2000000000u: {
+ var_1 = 30u;
+ break;
+ }
+ case 20u: {
+ var_1 = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.msl
new file mode 100644
index 0000000..1fd89e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.msl
@@ -0,0 +1,32 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 50u: {
+ *(tint_symbol_1) = 40u;
+ break;
+ }
+ case 2000000000u: {
+ *(tint_symbol_1) = 30u;
+ break;
+ }
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.spvasm
new file mode 100644
index 0000000..dc8924f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.spvasm
@@ -0,0 +1,49 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_40 = OpConstant %uint 40
+ %uint_30 = OpConstant %uint 30
+ %uint_20 = OpConstant %uint 20
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 50 %13 2000000000 %14 20 %15
+ %13 = OpLabel
+ OpStore %var_1 %uint_40
+ OpBranch %10
+ %14 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %10
+ %15 = OpLabel
+ OpStore %var_1 %uint_20
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.wgsl
new file mode 100644
index 0000000..fcfc593
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 50u: {
+ var_1 = 40u;
+ }
+ case 2000000000u: {
+ var_1 = 30u;
+ }
+ case 20u: {
+ var_1 = 20u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm
new file mode 100644
index 0000000..aded929
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %30 20 %20 40 %40
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranch %99
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %99
+%40 = OpLabel
+OpStore %var %uint_40
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.hlsl
new file mode 100644
index 0000000..808a33f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 40u;
+ break;
+ }
+ case 20u: {
+ var_1 = 20u;
+ break;
+ }
+ default: {
+ var_1 = 30u;
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.msl
new file mode 100644
index 0000000..e6c97a1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 40u: {
+ *(tint_symbol_1) = 40u;
+ break;
+ }
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ break;
+ }
+ default: {
+ *(tint_symbol_1) = 30u;
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.spvasm
new file mode 100644
index 0000000..51a1ac2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.spvasm
@@ -0,0 +1,47 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_40 = OpConstant %uint 40
+ %uint_20 = OpConstant %uint 20
+ %uint_30 = OpConstant %uint 30
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 40 %13 20 %14
+ %13 = OpLabel
+ OpStore %var_1 %uint_40
+ OpBranch %10
+ %14 = OpLabel
+ OpStore %var_1 %uint_20
+ OpBranch %10
+ %12 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.wgsl
new file mode 100644
index 0000000..9f0eaa9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 40u;
+ }
+ case 20u: {
+ var_1 = 20u;
+ }
+ default: {
+ var_1 = 30u;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm
new file mode 100644
index 0000000..b4968bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %30 20 %20 30 %30 40 %40
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranch %99
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %99
+%40 = OpLabel
+OpStore %var %uint_40
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..41e966a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.hlsl
@@ -0,0 +1,29 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 40u;
+ break;
+ }
+ case 20u: {
+ var_1 = 20u;
+ break;
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 30u: {
+ var_1 = 30u;
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.msl
new file mode 100644
index 0000000..e78e905
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.msl
@@ -0,0 +1,32 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 40u: {
+ *(tint_symbol_1) = 40u;
+ break;
+ }
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ break;
+ }
+ default: {
+ /* fallthrough */
+ }
+ case 30u: {
+ *(tint_symbol_1) = 30u;
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..c8eacd3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.spvasm
@@ -0,0 +1,49 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_40 = OpConstant %uint 40
+ %uint_20 = OpConstant %uint 20
+ %uint_30 = OpConstant %uint 30
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 40 %13 20 %14 30 %15
+ %13 = OpLabel
+ OpStore %var_1 %uint_40
+ OpBranch %10
+ %14 = OpLabel
+ OpStore %var_1 %uint_20
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %15
+ %15 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..b933eab
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.wgsl
@@ -0,0 +1,26 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 40u: {
+ var_1 = 40u;
+ }
+ case 20u: {
+ var_1 = 20u;
+ }
+ default: {
+ fallthrough;
+ }
+ case 30u: {
+ var_1 = 30u;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm
new file mode 100644
index 0000000..cac0e45
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20 30 %30 40 %20
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranch %99
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.hlsl
new file mode 100644
index 0000000..3f4408c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.hlsl
@@ -0,0 +1,26 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 30u: {
+ var_1 = 30u;
+ break;
+ }
+ case 20u:
+ case 40u: {
+ var_1 = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.msl
new file mode 100644
index 0000000..d0df57a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 30u: {
+ *(tint_symbol_1) = 30u;
+ break;
+ }
+ case 20u:
+ case 40u: {
+ *(tint_symbol_1) = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.spvasm
new file mode 100644
index 0000000..c89d848
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_30 = OpConstant %uint 30
+ %uint_20 = OpConstant %uint 20
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 30 %13 20 %14 40 %14
+ %13 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %10
+ %14 = OpLabel
+ OpStore %var_1 %uint_20
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.wgsl
new file mode 100644
index 0000000..9e4b23f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 30u: {
+ var_1 = 30u;
+ }
+ case 20u, 40u: {
+ var_1 = 20u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm
new file mode 100644
index 0000000..8a052ae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.hlsl
new file mode 100644
index 0000000..1fcc430
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.msl
new file mode 100644
index 0000000..cfffd8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.spvasm
new file mode 100644
index 0000000..330516e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.wgsl
new file mode 100644
index 0000000..5d5acac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm
new file mode 100644
index 0000000..d0e1419
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..dc27829
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.msl
new file mode 100644
index 0000000..722311b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..3533650
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.spvasm
@@ -0,0 +1,41 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_20 = OpConstant %uint 20
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 20 %13
+ %13 = OpLabel
+ OpStore %var_1 %uint_20
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..8452e21
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 20u: {
+ var_1 = 20u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm
new file mode 100644
index 0000000..d083181
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpStore %var %uint_1
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20 30 %30
+%20 = OpLabel
+OpStore %var %uint_20
+OpBranch %99
+%30 = OpLabel
+OpStore %var %uint_30
+OpBranch %99
+%99 = OpLabel
+OpStore %var %uint_7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.hlsl
new file mode 100644
index 0000000..acad3e5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.hlsl
@@ -0,0 +1,25 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 30u: {
+ var_1 = 30u;
+ break;
+ }
+ case 20u: {
+ var_1 = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.msl
new file mode 100644
index 0000000..4fdb0f6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.msl
@@ -0,0 +1,28 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 1u;
+ switch(42u) {
+ case 30u: {
+ *(tint_symbol_1) = 30u;
+ break;
+ }
+ case 20u: {
+ *(tint_symbol_1) = 20u;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ *(tint_symbol_1) = 7u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.spvasm
new file mode 100644
index 0000000..1a30d6c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_42 = OpConstant %uint 42
+ %uint_30 = OpConstant %uint 30
+ %uint_20 = OpConstant %uint 20
+ %uint_7 = OpConstant %uint 7
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %var_1 %uint_1
+ OpSelectionMerge %10 None
+ OpSwitch %uint_42 %12 30 %13 20 %14
+ %13 = OpLabel
+ OpStore %var_1 %uint_30
+ OpBranch %10
+ %14 = OpLabel
+ OpStore %var_1 %uint_20
+ OpBranch %10
+ %12 = OpLabel
+ OpBranch %10
+ %10 = OpLabel
+ OpStore %var_1 %uint_7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.wgsl
new file mode 100644
index 0000000..9668adb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ var_1 = 1u;
+ switch(42u) {
+ case 30u: {
+ var_1 = 30u;
+ }
+ case 20u: {
+ var_1 = 20u;
+ }
+ default: {
+ }
+ }
+ var_1 = 7u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm
new file mode 100644
index 0000000..fa8b95e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%6 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%5 = OpLabel
+OpBranch %10
+%10 = OpLabel
+OpLoopMerge %99 %90 None
+OpBranch %20
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %6 %90 %30
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %90
+%90 = OpLabel
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.hlsl
new file mode 100644
index 0000000..3107abb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ continue;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.msl
new file mode 100644
index 0000000..a0c4009
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ continue;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.spvasm
new file mode 100644
index 0000000..dc36d5b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.spvasm
@@ -0,0 +1,43 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpBranch %11
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.wgsl
new file mode 100644
index 0000000..76e6581
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ continue;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm
new file mode 100644
index 0000000..b840e98
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_20 %99 20 %20
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %5 %99 %30
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.hlsl
new file mode 100644
index 0000000..f7b800d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(20u) {
+ case 20u: {
+ if (false) {
+ break;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.msl
new file mode 100644
index 0000000..0b3ef61
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(20u) {
+ case 20u: {
+ if (false) {
+ break;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.spvasm
new file mode 100644
index 0000000..79f2cfc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_20 %11 20 %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpBranch %9
+ %15 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.wgsl
new file mode 100644
index 0000000..f65408d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(20u) {
+ case 20u: {
+ if (false) {
+ break;
+ }
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm
new file mode 100644
index 0000000..7caca10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%200 = OpFunction %uint None %14
+%210 = OpLabel
+OpUnreachable
+OpFunctionEnd
+%100 = OpFunction %void None %3
+%10 = OpLabel
+%11 = OpFunctionCall %uint %200
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.hlsl
new file mode 100644
index 0000000..b169b45
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+uint x_200() {
+ return 0u;
+}
+
+void main_1() {
+ const uint x_11 = x_200();
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.msl
new file mode 100644
index 0000000..cb0c2e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint x_200() {
+ return 0u;
+}
+
+void main_1() {
+ uint const x_11 = x_200();
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.spvasm
new file mode 100644
index 0000000..ff27b30
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %5 = OpTypeFunction %uint
+ %uint_0 = OpConstant %uint 0
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %x_200 = OpFunction %uint None %5
+ %7 = OpLabel
+ OpReturnValue %uint_0
+ OpFunctionEnd
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %13 = OpFunctionCall %uint %x_200
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.wgsl
new file mode 100644
index 0000000..99dd21f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn x_200() -> u32 {
+ return 0u;
+}
+
+fn main_1() {
+ let x_11 : u32 = x_200();
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm
new file mode 100644
index 0000000..ba52a28
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %99
+%20 = OpLabel
+OpUnreachable
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..dc451e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ return;
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.msl
new file mode 100644
index 0000000..fb3b83a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ return;
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..9558a9a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpReturn
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..4da92df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ return;
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm
new file mode 100644
index 0000000..8756f4a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %30
+%30 = OpLabel
+OpUnreachable
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..b9dbbea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ return;
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.msl
new file mode 100644
index 0000000..d80c8fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ return;
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..f445af6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpReturn
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..3e1a55f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ return;
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm
new file mode 100644
index 0000000..cbd262d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpUnreachable
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm
new file mode 100644
index 0000000..3703e82
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %99 %30
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm
new file mode 100644
index 0000000..90c868e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%6 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%5 = OpLabel
+OpBranch %10
+%10 = OpLabel
+OpLoopMerge %99 %90 None
+OpBranch %20
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %6 %30 %99
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %90
+%90 = OpLabel
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm
new file mode 100644
index 0000000..4f0040d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%6 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%5 = OpLabel
+OpBranch %10
+%10 = OpLabel
+OpLoopMerge %99 %90 None
+OpBranch %20
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %6 %30 %90
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %90
+%90 = OpLabel
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.hlsl
new file mode 100644
index 0000000..d31cc7f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ continue;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.msl
new file mode 100644
index 0000000..6ea82c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ continue;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.spvasm
new file mode 100644
index 0000000..8c7bc0c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %11
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.wgsl
new file mode 100644
index 0000000..169951e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ continue;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm
new file mode 100644
index 0000000..fd61136
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_20 %99 20 %20
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.hlsl
new file mode 100644
index 0000000..ea27551
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.hlsl
@@ -0,0 +1,22 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(20u) {
+ case 20u: {
+ if (false) {
+ } else {
+ break;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.msl
new file mode 100644
index 0000000..1d512d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(20u) {
+ case 20u: {
+ if (false) {
+ } else {
+ break;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.spvasm
new file mode 100644
index 0000000..0d6e7ce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_20 %11 20 %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %9
+ %15 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.wgsl
new file mode 100644
index 0000000..419b2af
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(20u) {
+ case 20u: {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm
new file mode 100644
index 0000000..f791332
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm
new file mode 100644
index 0000000..6ff6725
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm
new file mode 100644
index 0000000..9717482
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %30
+%20 = OpLabel
+OpBranch %80
+%30 = OpLabel
+OpBranch %20
+%80 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.hlsl
new file mode 100644
index 0000000..6280e0e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ if (true) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.msl
new file mode 100644
index 0000000..ec038a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ if (true) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.spvasm
new file mode 100644
index 0000000..0979ee2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpSelectionMerge %14 None
+ OpBranchConditional %true %15 %14
+ %15 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.wgsl
new file mode 100644
index 0000000..4abd08f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.wgsl
@@ -0,0 +1,14 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ if (true) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm
new file mode 100644
index 0000000..c43e8a8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %30
+%20 = OpLabel
+OpBranch %80
+%30 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.hlsl
new file mode 100644
index 0000000..6280e0e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ if (true) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.msl
new file mode 100644
index 0000000..ec038a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ if (true) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.spvasm
new file mode 100644
index 0000000..0979ee2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpSelectionMerge %14 None
+ OpBranchConditional %true %15 %14
+ %15 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.wgsl
new file mode 100644
index 0000000..4abd08f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.wgsl
@@ -0,0 +1,14 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ if (true) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm
new file mode 100644
index 0000000..00b1c437
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %30
+%20 = OpLabel
+OpBranch %30
+%30 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.hlsl
new file mode 100644
index 0000000..6280e0e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ if (true) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.msl
new file mode 100644
index 0000000..ec038a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ if (true) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.spvasm
new file mode 100644
index 0000000..0979ee2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpSelectionMerge %14 None
+ OpBranchConditional %true %15 %14
+ %15 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.wgsl
new file mode 100644
index 0000000..4abd08f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.wgsl
@@ -0,0 +1,14 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ if (true) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm
new file mode 100644
index 0000000..48a2bf8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %20
+%20 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm
new file mode 100644
index 0000000..26bdfac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %30
+%20 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm
new file mode 100644
index 0000000..23a7a13
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%6 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%5 = OpLabel
+OpBranch %10
+%10 = OpLabel
+OpLoopMerge %99 %90 None
+OpBranch %20
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %6 %99 %30
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %90
+%90 = OpLabel
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.hlsl
new file mode 100644
index 0000000..53d908c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.msl
new file mode 100644
index 0000000..fc2a957
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.spvasm
new file mode 100644
index 0000000..e406af2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.spvasm
@@ -0,0 +1,43 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.wgsl
new file mode 100644
index 0000000..d089493
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm
new file mode 100644
index 0000000..466dc83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%6 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%5 = OpLabel
+OpBranch %10
+%10 = OpLabel
+OpLoopMerge %99 %90 None
+OpBranch %20
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %6 %90 %30
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %90
+%90 = OpLabel
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.hlsl
new file mode 100644
index 0000000..3107abb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ continue;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.msl
new file mode 100644
index 0000000..a0c4009
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ continue;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.spvasm
new file mode 100644
index 0000000..dc36d5b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.spvasm
@@ -0,0 +1,43 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpBranch %11
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.wgsl
new file mode 100644
index 0000000..76e6581
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ continue;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm
new file mode 100644
index 0000000..51bf86f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_20 %99 20 %20
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %5 %99 %30
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.hlsl
new file mode 100644
index 0000000..f7b800d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(20u) {
+ case 20u: {
+ if (false) {
+ break;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.msl
new file mode 100644
index 0000000..0b3ef61
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(20u) {
+ case 20u: {
+ if (false) {
+ break;
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.spvasm
new file mode 100644
index 0000000..79f2cfc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_20 %11 20 %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpBranch %9
+ %15 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.wgsl
new file mode 100644
index 0000000..f65408d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(20u) {
+ case 20u: {
+ if (false) {
+ break;
+ }
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm
new file mode 100644
index 0000000..d3d312c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %20 200 %20
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.hlsl
new file mode 100644
index 0000000..a018399
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ default: {
+ /* fallthrough */
+ }
+ case 200u: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.msl
new file mode 100644
index 0000000..2c5820d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ default: {
+ /* fallthrough */
+ }
+ case 200u: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.spvasm
new file mode 100644
index 0000000..2ab5766
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 200 %12
+ %11 = OpLabel
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.wgsl
new file mode 100644
index 0000000..f7802bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ default: {
+ fallthrough;
+ }
+ case 200u: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm
new file mode 100644
index 0000000..789f835
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %30 200 %20
+%20 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.hlsl
new file mode 100644
index 0000000..c9cc499
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 200u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.msl
new file mode 100644
index 0000000..53a599e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 200u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.spvasm
new file mode 100644
index 0000000..64b98ee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 200 %12
+ %12 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.wgsl
new file mode 100644
index 0000000..d498fce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 200u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm
new file mode 100644
index 0000000..01c9cbf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.hlsl
new file mode 100644
index 0000000..b37d337
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.msl
new file mode 100644
index 0000000..9ea19ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.spvasm
new file mode 100644
index 0000000..53e2006
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12
+ %12 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.wgsl
new file mode 100644
index 0000000..fe32b0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm
new file mode 100644
index 0000000..3bf418c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %30 20 %20
+%20 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.hlsl
new file mode 100644
index 0000000..b37d337
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.msl
new file mode 100644
index 0000000..9ea19ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.spvasm
new file mode 100644
index 0000000..53e2006
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12
+ %12 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.wgsl
new file mode 100644
index 0000000..fe32b0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm
new file mode 100644
index 0000000..a517cd2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 200 %20 300 %20
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..8b113db
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 200u:
+ case 300u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.msl
new file mode 100644
index 0000000..7c822a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 200u:
+ case 300u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..f2feb0e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 200 %12 300 %12
+ %12 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..2913781
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 200u, 300u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm
new file mode 100644
index 0000000..ae31efe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm
new file mode 100644
index 0000000..67d4acf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %30
+%20 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm
new file mode 100644
index 0000000..2f4f1d5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %90 None
+OpBranchConditional %5 %30 %40
+%30 = OpLabel
+OpBranch %90
+%40 = OpLabel
+OpBranch %90
+%90 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.hlsl
new file mode 100644
index 0000000..3107abb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ continue;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.msl
new file mode 100644
index 0000000..a0c4009
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ continue;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.spvasm
new file mode 100644
index 0000000..dc36d5b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.spvasm
@@ -0,0 +1,43 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %15
+ %16 = OpLabel
+ OpBranch %11
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.wgsl
new file mode 100644
index 0000000..76e6581
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ continue;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm
new file mode 100644
index 0000000..a205973
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %50 None
+OpBranchConditional %5 %20 %50
+%20 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpLoopMerge %99 %60 None
+OpBranchConditional %5 %60 %99
+%60 = OpLabel
+OpBranch %50
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.hlsl
new file mode 100644
index 0000000..3848446
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.msl
new file mode 100644
index 0000000..94480e4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.spvasm
new file mode 100644
index 0000000..2368871
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.spvasm
@@ -0,0 +1,50 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpLoopMerge %14 %15 None
+ OpBranch %16
+ %16 = OpLabel
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %19
+ %18 = OpLabel
+ OpBranch %17
+ %19 = OpLabel
+ OpBranch %14
+ %17 = OpLabel
+ OpBranch %15
+ %15 = OpLabel
+ OpBranch %13
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.wgsl
new file mode 100644
index 0000000..c4f4627
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm
new file mode 100644
index 0000000..235ded20
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %50 None
+OpBranchConditional %5 %20 %50
+%20 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpLoopMerge %99 %50 None
+OpBranchConditional %5 %50 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..4058d37e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ {
+ for(; false; ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.msl
new file mode 100644
index 0000000..94480e4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..2368871
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.spvasm
@@ -0,0 +1,50 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpLoopMerge %14 %15 None
+ OpBranch %16
+ %16 = OpLabel
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %19
+ %18 = OpLabel
+ OpBranch %17
+ %19 = OpLabel
+ OpBranch %14
+ %17 = OpLabel
+ OpBranch %15
+ %15 = OpLabel
+ OpBranch %13
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..c4f4627
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm
new file mode 100644
index 0000000..762da21
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranch %30
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6998ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ {
+ for(; false; ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm
new file mode 100644
index 0000000..c616065
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %40 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm
new file mode 100644
index 0000000..3b21fe3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm
@@ -0,0 +1,65 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %50
+%20 = OpLabel
+OpSelectionMerge %40 None
+OpBranchConditional %5 %30 %40
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %49
+%49 = OpLabel
+OpBranch %99
+%50 = OpLabel
+OpSelectionMerge %89 None
+OpBranchConditional %5 %89 %60
+%60 = OpLabel
+OpBranch %89
+%89 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.hlsl
new file mode 100644
index 0000000..1739c33
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ if (false) {
+ }
+ } else {
+ if (false) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.msl
new file mode 100644
index 0000000..2384b83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ if (false) {
+ }
+ } else {
+ if (false) {
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.spvasm
new file mode 100644
index 0000000..6704967
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.spvasm
@@ -0,0 +1,46 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %13
+ %12 = OpLabel
+ OpSelectionMerge %14 None
+ OpBranchConditional %false %15 %14
+ %15 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpBranch %11
+ %13 = OpLabel
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %16
+ %17 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.wgsl
new file mode 100644
index 0000000..f60e6ae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ if (false) {
+ }
+ } else {
+ if (false) {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm
new file mode 100644
index 0000000..6ebd600
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %99
+%20 = OpLabel
+OpLoopMerge %89 %40 None
+OpBranchConditional %5 %30 %89
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %20
+%89 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..0033e41
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.msl
new file mode 100644
index 0000000..3869dc8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..e669414
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.spvasm
@@ -0,0 +1,50 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpLoopMerge %14 %15 None
+ OpBranch %16
+ %16 = OpLabel
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %19
+ %18 = OpLabel
+ OpBranch %17
+ %19 = OpLabel
+ OpBranch %14
+ %17 = OpLabel
+ OpBranch %15
+ %15 = OpLabel
+ OpBranch %13
+ %14 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..bcc1dec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm
new file mode 100644
index 0000000..990697f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %99
+%20 = OpLabel
+OpLoopMerge %89 %20 None
+OpBranchConditional %5 %20 %89
+%89 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..38d4913
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ {
+ for(; false; ) {
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.msl
new file mode 100644
index 0000000..3869dc8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..e669414
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.spvasm
@@ -0,0 +1,50 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpLoopMerge %14 %15 None
+ OpBranch %16
+ %16 = OpLabel
+ OpSelectionMerge %17 None
+ OpBranchConditional %false %18 %19
+ %18 = OpLabel
+ OpBranch %17
+ %19 = OpLabel
+ OpBranch %14
+ %17 = OpLabel
+ OpBranch %15
+ %15 = OpLabel
+ OpBranch %13
+ %14 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..bcc1dec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm
new file mode 100644
index 0000000..c453eef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %99
+%20 = OpLabel
+OpSelectionMerge %89 None
+OpSwitch %uint_42 %89 20 %30
+%30 = OpLabel
+OpBranch %89
+%89 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.hlsl
new file mode 100644
index 0000000..905bf2e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.msl
new file mode 100644
index 0000000..34d6676
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.spvasm
new file mode 100644
index 0000000..814f5d4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpSelectionMerge %13 None
+ OpSwitch %uint_42 %15 20 %16
+ %16 = OpLabel
+ OpBranch %13
+ %15 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.wgsl
new file mode 100644
index 0000000..ac2fe60
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ switch(42u) {
+ case 20u: {
+ }
+ default: {
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm
new file mode 100644
index 0000000..a7548d7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm
@@ -0,0 +1,58 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %30 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %49 None
+OpBranchConditional %true %40 %49
+%40 = OpLabel
+OpBranch %49
+%49 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.hlsl
new file mode 100644
index 0000000..b39c5d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ {
+ if (true) {
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.msl
new file mode 100644
index 0000000..a4a4352
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ {
+ if (true) {
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.spvasm
new file mode 100644
index 0000000..0ca7bb7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpBranch %19
+ %19 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.wgsl
new file mode 100644
index 0000000..6dc2d6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+
+ continuing {
+ if (true) {
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm
new file mode 100644
index 0000000..d24020d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpSelectionMerge %49 None
+OpBranchConditional %true %40 %49
+%40 = OpLabel
+OpBranch %49
+%49 = OpLabel
+OpBranch %80
+%80 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.hlsl
new file mode 100644
index 0000000..aca28ce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.msl
new file mode 100644
index 0000000..3d8920a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.spvasm
new file mode 100644
index 0000000..84909b2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpSelectionMerge %19 None
+ OpBranchConditional %true %20 %19
+ %20 = OpLabel
+ OpBranch %19
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.wgsl
new file mode 100644
index 0000000..3ce9f4e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ if (true) {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm
new file mode 100644
index 0000000..0acd695
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm
@@ -0,0 +1,62 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %89 %50 None
+OpBranchConditional %5 %30 %89
+%30 = OpLabel
+OpLoopMerge %40 %30 None
+OpBranchConditional %true %30 %40
+%40 = OpLabel
+OpBranch %50
+%50 = OpLabel
+OpBranch %60
+%60 = OpLabel
+OpBranch %20
+%89 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.hlsl
new file mode 100644
index 0000000..b858639
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.hlsl
@@ -0,0 +1,20 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ {
+ for(; true; ) {
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.msl
new file mode 100644
index 0000000..82f6bba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ while (true) {
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.spvasm
new file mode 100644
index 0000000..60462be
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.spvasm
@@ -0,0 +1,62 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpLoopMerge %19 %20 None
+ OpBranch %21
+ %21 = OpLabel
+ OpSelectionMerge %23 None
+ OpBranchConditional %true %24 %25
+ %24 = OpLabel
+ OpBranch %23
+ %25 = OpLabel
+ OpBranch %19
+ %23 = OpLabel
+ OpBranch %20
+ %20 = OpLabel
+ OpBranch %18
+ %19 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.wgsl
new file mode 100644
index 0000000..de05e86
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ loop {
+ if (true) {
+ } else {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm
new file mode 100644
index 0000000..28744d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm
@@ -0,0 +1,63 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20 50 %50
+%20 = OpLabel
+OpSelectionMerge %49 None
+OpBranchConditional %5 %30 %49
+%30 = OpLabel
+OpBranch %49
+%49 = OpLabel
+OpBranch %99
+%50 = OpLabel
+OpSelectionMerge %89 None
+OpBranchConditional %5 %89 %60
+%60 = OpLabel
+OpBranch %89
+%89 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.hlsl
new file mode 100644
index 0000000..3aae378
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.hlsl
@@ -0,0 +1,25 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 50u: {
+ if (false) {
+ }
+ break;
+ }
+ case 20u: {
+ if (false) {
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.msl
new file mode 100644
index 0000000..7524d03
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 50u: {
+ if (false) {
+ }
+ break;
+ }
+ case 20u: {
+ if (false) {
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.spvasm
new file mode 100644
index 0000000..590fccb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.spvasm
@@ -0,0 +1,49 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 50 %12 20 %13
+ %12 = OpLabel
+ OpSelectionMerge %16 None
+ OpBranchConditional %false %17 %16
+ %17 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpBranch %9
+ %13 = OpLabel
+ OpSelectionMerge %18 None
+ OpBranchConditional %false %19 %18
+ %19 = OpLabel
+ OpBranch %18
+ %18 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.wgsl
new file mode 100644
index 0000000..3a7d97b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 50u: {
+ if (false) {
+ }
+ }
+ case 20u: {
+ if (false) {
+ }
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm
new file mode 100644
index 0000000..a9b7461
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%6 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %5
+%5 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm
new file mode 100644
index 0000000..3e3fe5f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm
new file mode 100644
index 0000000..24b392a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%6 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%14 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%5 = OpLabel
+OpBranch %10
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %6 %20 %30
+%20 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpBranch %200
+%200 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm
new file mode 100644
index 0000000..48e5c26
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6998ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ {
+ for(; false; ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm
new file mode 100644
index 0000000..0fd8734
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %40 20 %20 30 %30
+%20 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %99
+%40 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.hlsl
new file mode 100644
index 0000000..77d4580
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 30u: {
+ break;
+ }
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.msl
new file mode 100644
index 0000000..edafec2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 30u: {
+ break;
+ }
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.spvasm
new file mode 100644
index 0000000..d3cfeb1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 30 %12 20 %13
+ %12 = OpLabel
+ OpBranch %9
+ %13 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.wgsl
new file mode 100644
index 0000000..8509af3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 30u: {
+ }
+ case 20u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm
new file mode 100644
index 0000000..9965520
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranch %40
+%40 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.hlsl
new file mode 100644
index 0000000..bf1cd07
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.msl
new file mode 100644
index 0000000..598fdda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.spvasm
new file mode 100644
index 0000000..abe0206
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.wgsl
new file mode 100644
index 0000000..8c64952
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm
new file mode 100644
index 0000000..8ceeb66
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %40 None
+OpBranch %30
+%30 = OpLabel
+OpBranchConditional %5 %40 %99
+%40 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm
new file mode 100644
index 0000000..d1c8fbf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %40 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm
new file mode 100644
index 0000000..b3031ae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6998ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ {
+ for(; false; ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm
new file mode 100644
index 0000000..b686e85
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %99
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm
new file mode 100644
index 0000000..9f0e297
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %99 20 %20
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.hlsl
new file mode 100644
index 0000000..b37d337
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.msl
new file mode 100644
index 0000000..9ea19ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.spvasm
new file mode 100644
index 0000000..53e2006
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12
+ %12 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.wgsl
new file mode 100644
index 0000000..fe32b0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm
new file mode 100644
index 0000000..f49c3e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_RegisterMerges_NoMerges.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm
new file mode 100644
index 0000000..00c32d6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranch %30
+%30 = OpLabel
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6998ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ {
+ for(; false; ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm
new file mode 100644
index 0000000..5a602a2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %30 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm
new file mode 100644
index 0000000..849d3bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm
new file mode 100644
index 0000000..c54dceb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm
new file mode 100644
index 0000000..4d84389
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6998ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ {
+ for(; false; ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm
new file mode 100644
index 0000000..04f7fd5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_TerminatorsAreValid_If.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%12 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%20 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %30 %40
+%30 = OpLabel
+OpBranch %99
+%40 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm
new file mode 100644
index 0000000..3506a29
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpKill
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.hlsl
new file mode 100644
index 0000000..856a956
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ discard;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.msl
new file mode 100644
index 0000000..f5d3c1b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ discard_fragment();
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.spvasm
new file mode 100644
index 0000000..8b592e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpKill
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.wgsl
new file mode 100644
index 0000000..dfd6d9e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ discard;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm
new file mode 100644
index 0000000..921dbaf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %40 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %40
+%40 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm
new file mode 100644
index 0000000..8f0a252
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6998ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ {
+ for(; false; ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm
new file mode 100644
index 0000000..3ea0da9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%12 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%20 = OpLabel
+OpBranch %30
+%30 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm
new file mode 100644
index 0000000..7affba1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%12 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%42 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm
new file mode 100644
index 0000000..4269988
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_42 %80 20 %20 30 %30
+%20 = OpLabel
+OpBranch %30
+%30 = OpLabel
+OpBranch %99
+%80 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.hlsl
new file mode 100644
index 0000000..08cf13f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ /* fallthrough */
+ }
+ case 30u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.msl
new file mode 100644
index 0000000..9b574ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ switch(42u) {
+ case 20u: {
+ /* fallthrough */
+ }
+ case 30u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.spvasm
new file mode 100644
index 0000000..fb94495
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %9 None
+ OpSwitch %uint_42 %11 20 %12 30 %13
+ %12 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpBranch %9
+ %11 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.wgsl
new file mode 100644
index 0000000..d39a7b8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ switch(42u) {
+ case 20u: {
+ fallthrough;
+ }
+ case 30u: {
+ }
+ default: {
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm
new file mode 100644
index 0000000..a58a785
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpUnreachable
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.hlsl
new file mode 100644
index 0000000..a126c6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.spvasm
new file mode 100644
index 0000000..4486cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb48a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm
new file mode 100644
index 0000000..4816380
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %30 None
+OpBranchConditional %5 %30 %99
+%30 = OpLabel
+OpBranch %20
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.hlsl
new file mode 100644
index 0000000..ad01345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm
new file mode 100644
index 0000000..ba80266
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %5 %20 %30
+%20 = OpLabel
+OpBranch %99
+%30 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.hlsl
new file mode 100644
index 0000000..581055b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.msl
new file mode 100644
index 0000000..4661d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ if (false) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.spvasm
new file mode 100644
index 0000000..857ac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9d9b8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ if (false) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm
new file mode 100644
index 0000000..2e55e95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 1000
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%5 = OpConstantNull %bool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%uint_42 = OpConstant %uint 42
+%int_42 = OpConstant %int 42
+%13 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%uint_6 = OpConstant %uint 6
+%uint_7 = OpConstant %uint 7
+%uint_8 = OpConstant %uint 8
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_30 = OpConstant %uint 30
+%uint_40 = OpConstant %uint 40
+%uint_50 = OpConstant %uint 50
+%uint_90 = OpConstant %uint 90
+%uint_99 = OpConstant %uint 99
+%_ptr_Private_uint = OpTypePointer Private %uint
+%var = OpVariable %_ptr_Private_uint Private
+%uint_999 = OpConstant %uint 999
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %20 None
+OpBranchConditional %5 %20 %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.hlsl
new file mode 100644
index 0000000..a6998ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint var_1 = 0u;
+
+void main_1() {
+ {
+ for(; false; ) {
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.msl
new file mode 100644
index 0000000..52904a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f107a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.spvasm
@@ -0,0 +1,45 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %var_1 "var_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %var_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpLoopMerge %10 %11 None
+ OpBranch %12
+ %12 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %false %16 %17
+ %16 = OpLabel
+ OpBranch %15
+ %17 = OpLabel
+ OpBranch %10
+ %15 = OpLabel
+ OpBranch %11
+ %11 = OpLabel
+ OpBranch %9
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.wgsl
new file mode 100644
index 0000000..834ea70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> var_1 : u32;
+
+fn main_1() {
+ loop {
+ if (false) {
+ } else {
+ break;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm
new file mode 100644
index 0000000..18c4e4d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%31 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_33 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%100 = OpFunction %void None %5
+%34 = OpLabel
+%1 = OpVariable %_ptr_Function_uint Function
+%2 = OpVariable %_ptr_Function_uint Function
+%3 = OpVariable %_ptr_Function_uint Function
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.hlsl
new file mode 100644
index 0000000..e89cc85
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ uint x_1 = 0u;
+ uint x_2 = 0u;
+ uint x_3 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.msl
new file mode 100644
index 0000000..7256baf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ uint x_1 = 0u;
+ uint x_2 = 0u;
+ uint x_3 = 0u;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.spvasm
new file mode 100644
index 0000000..a3c9176
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_1 "x_1"
+ OpName %x_2 "x_2"
+ OpName %x_3 "x_3"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %8 = OpConstantNull %uint
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_1 = OpVariable %_ptr_Function_uint Function %8
+ %x_2 = OpVariable %_ptr_Function_uint Function %8
+ %x_3 = OpVariable %_ptr_Function_uint Function %8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.wgsl
new file mode 100644
index 0000000..4c3887f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_1 : u32;
+ var x_2 : u32;
+ var x_3 : u32;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm
new file mode 100644
index 0000000..948446f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%28 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_30 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Function__arr_uint_uint_2 = OpTypePointer Function %_arr_uint_uint_2
+%uint_2_0 = OpConstant %uint 2
+%33 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2_0
+%100 = OpFunction %void None %2
+%34 = OpLabel
+%200 = OpVariable %_ptr_Function__arr_uint_uint_2 Function %33
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..6ac840c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ uint x_200[2] = {1u, 2u};
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..fc01ca2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ tint_array_wrapper x_200 = {.arr={1u, 2u}};
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..cc3cfdd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_200 "x_200"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_2 ArrayStride 4
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %uint_1 = OpConstant %uint 1
+ %9 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2
+%_ptr_Function__arr_uint_uint_2 = OpTypePointer Function %_arr_uint_uint_2
+ %12 = OpConstantNull %_arr_uint_uint_2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_200 = OpVariable %_ptr_Function__arr_uint_uint_2 Function %12
+ OpStore %x_200 %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..db2452e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_200 : array<u32, 2> = array<u32, 2>(1u, 2u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm
new file mode 100644
index 0000000..88b0b9a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpDecorate %_arr_uint_uint_2 ArrayStride 16
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%29 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_30 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Function__arr_uint_uint_2 = OpTypePointer Function %_arr_uint_uint_2
+%uint_2_0 = OpConstant %uint 2
+%33 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2_0
+%100 = OpFunction %void None %3
+%34 = OpLabel
+%200 = OpVariable %_ptr_Function__arr_uint_uint_2 Function %33
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.hlsl
new file mode 100644
index 0000000..39503fc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+struct tint_padded_array_element {
+ uint el;
+};
+
+void main_1() {
+ tint_padded_array_element x_200[2] = {{1u}, {2u}};
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.msl
new file mode 100644
index 0000000..f097d24
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_padded_array_element {
+ uint el;
+};
+struct tint_array_wrapper {
+ tint_padded_array_element arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ tint_array_wrapper x_200 = {.arr={{.el=1u}, {.el=2u}}};
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.spvasm
new file mode 100644
index 0000000..1825b90
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_200 "x_200"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_2 ArrayStride 16
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %uint_1 = OpConstant %uint 1
+ %9 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2
+%_ptr_Function__arr_uint_uint_2 = OpTypePointer Function %_arr_uint_uint_2
+ %12 = OpConstantNull %_arr_uint_uint_2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_200 = OpVariable %_ptr_Function__arr_uint_uint_2 Function %12
+ OpStore %x_200 %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.wgsl
new file mode 100644
index 0000000..a517f83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+type Arr = [[stride(16)]] array<u32, 2>;
+
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : Arr;
+};
+
+fn main_1() {
+ var x_200 : Arr = Arr(1u, 2u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm
new file mode 100644
index 0000000..6692c67
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpDecorate %_arr_uint_uint_2 ArrayStride 16
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%29 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_30 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Function__arr_uint_uint_2 = OpTypePointer Function %_arr_uint_uint_2
+%uint_2_0 = OpConstant %uint 2
+%33 = OpConstantNull %_arr_uint_uint_2
+%100 = OpFunction %void None %3
+%34 = OpLabel
+%200 = OpVariable %_ptr_Function__arr_uint_uint_2 Function %33
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.hlsl
new file mode 100644
index 0000000..5daca9f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+struct tint_padded_array_element {
+ uint el;
+};
+
+void main_1() {
+ tint_padded_array_element x_200[2] = {{0u}, {0u}};
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.msl
new file mode 100644
index 0000000..3a99c0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_padded_array_element {
+ uint el;
+};
+struct tint_array_wrapper {
+ tint_padded_array_element arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ tint_array_wrapper x_200 = {.arr={{.el=0u}, {.el=0u}}};
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.spvasm
new file mode 100644
index 0000000..ef2915c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_200 "x_200"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_2 ArrayStride 16
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %uint_0 = OpConstant %uint 0
+ %9 = OpConstantComposite %_arr_uint_uint_2 %uint_0 %uint_0
+%_ptr_Function__arr_uint_uint_2 = OpTypePointer Function %_arr_uint_uint_2
+ %12 = OpConstantNull %_arr_uint_uint_2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_200 = OpVariable %_ptr_Function__arr_uint_uint_2 Function %12
+ OpStore %x_200 %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.wgsl
new file mode 100644
index 0000000..be10f25
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+type Arr = [[stride(16)]] array<u32, 2>;
+
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : Arr;
+};
+
+fn main_1() {
+ var x_200 : Arr = Arr(0u, 0u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm
new file mode 100644
index 0000000..3461475
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%28 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_30 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Function__arr_uint_uint_2 = OpTypePointer Function %_arr_uint_uint_2
+%uint_2_0 = OpConstant %uint 2
+%33 = OpConstantNull %_arr_uint_uint_2
+%100 = OpFunction %void None %2
+%34 = OpLabel
+%200 = OpVariable %_ptr_Function__arr_uint_uint_2 Function %33
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.hlsl
new file mode 100644
index 0000000..c51a182
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ uint x_200[2] = {0u, 0u};
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.msl
new file mode 100644
index 0000000..de6f9c2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ tint_array_wrapper x_200 = {.arr={0u, 0u}};
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.spvasm
new file mode 100644
index 0000000..0aa594f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_200 "x_200"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_2 ArrayStride 4
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %uint_0 = OpConstant %uint 0
+ %9 = OpConstantComposite %_arr_uint_uint_2 %uint_0 %uint_0
+%_ptr_Function__arr_uint_uint_2 = OpTypePointer Function %_arr_uint_uint_2
+ %12 = OpConstantNull %_arr_uint_uint_2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_200 = OpVariable %_ptr_Function__arr_uint_uint_2 Function %12
+ OpStore %x_200 %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.wgsl
new file mode 100644
index 0000000..b8e3ed6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_200 : array<u32, 2> = array<u32, 2>(0u, 0u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm
new file mode 100644
index 0000000..873022b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm
@@ -0,0 +1,22 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+OpDecorate %myvar RelaxedPrecision
+%float = OpTypeFloat 32
+%_ptr_Function_float = OpTypePointer Function %float
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%100 = OpFunction %void None %5
+%6 = OpLabel
+%myvar = OpVariable %_ptr_Function_float Function
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.hlsl
new file mode 100644
index 0000000..529c7bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ float myvar = 0.0f;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.msl
new file mode 100644
index 0000000..74976c4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float myvar = 0.0f;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.spvasm
new file mode 100644
index 0000000..d5ae00f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %myvar "myvar"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+%_ptr_Function_float = OpTypePointer Function %float
+ %8 = OpConstantNull %float
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %myvar = OpVariable %_ptr_Function_float Function %8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.wgsl
new file mode 100644
index 0000000..dd324f6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ var myvar : f32;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm
new file mode 100644
index 0000000..1da4495
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%28 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_30 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%35 = OpConstantComposite %v2float %float_1_5 %float_2
+%36 = OpConstantComposite %v2float %float_2 %float_3
+%37 = OpConstantComposite %v2float %float_3 %float_4
+%38 = OpConstantComposite %mat3v2float %35 %36 %37
+%100 = OpFunction %void None %2
+%39 = OpLabel
+%200 = OpVariable %_ptr_Function_mat3v2float Function %38
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..b5e7894
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ float3x2 x_200 = float3x2(float2(1.5f, 2.0f), float2(2.0f, 3.0f), float2(3.0f, 4.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..f23bd3f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ float3x2 x_200 = float3x2(float2(1.5f, 2.0f), float2(2.0f, 3.0f), float2(3.0f, 4.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..4d0d45e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_200 "x_200"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+ %float_1_5 = OpConstant %float 1.5
+ %float_2 = OpConstant %float 2
+ %10 = OpConstantComposite %v2float %float_1_5 %float_2
+ %float_3 = OpConstant %float 3
+ %12 = OpConstantComposite %v2float %float_2 %float_3
+ %float_4 = OpConstant %float 4
+ %14 = OpConstantComposite %v2float %float_3 %float_4
+ %15 = OpConstantComposite %mat3v2float %10 %12 %14
+%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
+ %18 = OpConstantNull %mat3v2float
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_200 = OpVariable %_ptr_Function_mat3v2float Function %18
+ OpStore %x_200 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..20a04e2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_200 : mat3x2<f32> = mat3x2<f32>(vec2<f32>(1.5, 2.0), vec2<f32>(2.0, 3.0), vec2<f32>(3.0, 4.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm
new file mode 100644
index 0000000..72f94c1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm
@@ -0,0 +1,24 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+OpName %strct "strct"
+OpMemberDecorate %strct 0 RelaxedPrecision
+%float = OpTypeFloat 32
+%strct = OpTypeStruct %float
+%_ptr_Function_strct = OpTypePointer Function %strct
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%100 = OpFunction %void None %6
+%7 = OpLabel
+%myvar = OpVariable %_ptr_Function_strct Function
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.hlsl
new file mode 100644
index 0000000..bee12fd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+struct strct {
+ float field0;
+};
+
+void main_1() {
+ strct myvar = (strct)0;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.msl
new file mode 100644
index 0000000..a472ed1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct strct {
+ float field0;
+};
+
+void main_1() {
+ strct myvar = {};
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.spvasm
new file mode 100644
index 0000000..706ab89
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %strct "strct"
+ OpMemberName %strct 0 "field0"
+ OpName %myvar "myvar"
+ OpName %main "main"
+ OpMemberDecorate %strct 0 Offset 0
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %strct = OpTypeStruct %float
+%_ptr_Function_strct = OpTypePointer Function %strct
+ %9 = OpConstantNull %strct
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %myvar = OpVariable %_ptr_Function_strct Function %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.wgsl
new file mode 100644
index 0000000..2018ad4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+struct strct {
+ field0 : f32;
+};
+
+fn main_1() {
+ var myvar : strct;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm
new file mode 100644
index 0000000..78fe67f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %a "a"
+OpName %b "b"
+OpName %c "c"
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%31 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_33 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%100 = OpFunction %void None %5
+%34 = OpLabel
+%a = OpVariable %_ptr_Function_uint Function
+%b = OpVariable %_ptr_Function_int Function
+%c = OpVariable %_ptr_Function_float Function
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.hlsl
new file mode 100644
index 0000000..4b152b0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ uint a = 0u;
+ int b = 0;
+ float c = 0.0f;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.msl
new file mode 100644
index 0000000..5165012
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ uint a = 0u;
+ int b = 0;
+ float c = 0.0f;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.spvasm
new file mode 100644
index 0000000..f12a1f6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %a "a"
+ OpName %b "b"
+ OpName %c "c"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %8 = OpConstantNull %uint
+ %int = OpTypeInt 32 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %12 = OpConstantNull %int
+ %float = OpTypeFloat 32
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpConstantNull %float
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %a = OpVariable %_ptr_Function_uint Function %8
+ %b = OpVariable %_ptr_Function_int Function %12
+ %c = OpVariable %_ptr_Function_float Function %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.wgsl
new file mode 100644
index 0000000..724c200
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var a : u32;
+ var b : i32;
+ var c : f32;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm
new file mode 100644
index 0000000..439fd89
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %a "a"
+OpName %b "b"
+OpName %c "c"
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%31 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_33 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%100 = OpFunction %void None %5
+%34 = OpLabel
+%a = OpVariable %_ptr_Function_uint Function
+%b = OpVariable %_ptr_Function_uint Function
+%c = OpVariable %_ptr_Function_uint Function
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.hlsl
new file mode 100644
index 0000000..92a2bcc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ uint a = 0u;
+ uint b = 0u;
+ uint c = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.msl
new file mode 100644
index 0000000..60e829f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ uint a = 0u;
+ uint b = 0u;
+ uint c = 0u;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.spvasm
new file mode 100644
index 0000000..c4a447e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %a "a"
+ OpName %b "b"
+ OpName %c "c"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %8 = OpConstantNull %uint
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %a = OpVariable %_ptr_Function_uint Function %8
+ %b = OpVariable %_ptr_Function_uint Function %8
+ %c = OpVariable %_ptr_Function_uint Function %8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.wgsl
new file mode 100644
index 0000000..391c0d5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var a : u32;
+ var b : u32;
+ var c : u32;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm
new file mode 100644
index 0000000..9f5cf27
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm
@@ -0,0 +1,55 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %a "a"
+OpName %b "b"
+OpName %c "c"
+OpName %d "d"
+OpName %e "e"
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_35 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%100 = OpFunction %void None %7
+%36 = OpLabel
+%a = OpVariable %_ptr_Function_bool Function %true
+%b = OpVariable %_ptr_Function_bool Function %false
+%c = OpVariable %_ptr_Function_int Function %int_n1
+%d = OpVariable %_ptr_Function_uint Function %uint_1
+%e = OpVariable %_ptr_Function_float Function %float_1_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.hlsl
new file mode 100644
index 0000000..79b8275
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+void main_1() {
+ bool a = true;
+ bool b = false;
+ int c = -1;
+ uint d = 1u;
+ float e = 1.5f;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.msl
new file mode 100644
index 0000000..b353732
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ bool a = true;
+ bool b = false;
+ int c = -1;
+ uint d = 1u;
+ float e = 1.5f;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.spvasm
new file mode 100644
index 0000000..ab7324f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %a "a"
+ OpName %b "b"
+ OpName %c "c"
+ OpName %d "d"
+ OpName %e "e"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %9 = OpConstantNull %bool
+ %false = OpConstantFalse %bool
+ %int = OpTypeInt 32 1
+ %int_n1 = OpConstant %int -1
+%_ptr_Function_int = OpTypePointer Function %int
+ %16 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %21 = OpConstantNull %uint
+ %float = OpTypeFloat 32
+ %float_1_5 = OpConstant %float 1.5
+%_ptr_Function_float = OpTypePointer Function %float
+ %26 = OpConstantNull %float
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %a = OpVariable %_ptr_Function_bool Function %9
+ %b = OpVariable %_ptr_Function_bool Function %9
+ %c = OpVariable %_ptr_Function_int Function %16
+ %d = OpVariable %_ptr_Function_uint Function %21
+ %e = OpVariable %_ptr_Function_float Function %26
+ OpStore %a %true
+ OpStore %b %false
+ OpStore %c %int_n1
+ OpStore %d %uint_1
+ OpStore %e %float_1_5
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.wgsl
new file mode 100644
index 0000000..f37bcb0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var a : bool = true;
+ var b : bool = false;
+ var c : i32 = -1;
+ var d : u32 = 1u;
+ var e : f32 = 1.5;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm
new file mode 100644
index 0000000..8688763
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %a "a"
+OpName %b "b"
+OpName %c "c"
+OpName %d "d"
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_34 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%35 = OpConstantNull %bool
+%36 = OpConstantNull %int
+%37 = OpConstantNull %uint
+%38 = OpConstantNull %float
+%100 = OpFunction %void None %6
+%39 = OpLabel
+%a = OpVariable %_ptr_Function_bool Function %35
+%b = OpVariable %_ptr_Function_int Function %36
+%c = OpVariable %_ptr_Function_uint Function %37
+%d = OpVariable %_ptr_Function_float Function %38
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.hlsl
new file mode 100644
index 0000000..b9e839b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void main_1() {
+ bool a = false;
+ int b = 0;
+ uint c = 0u;
+ float d = 0.0f;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.msl
new file mode 100644
index 0000000..43076d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ bool a = false;
+ int b = 0;
+ uint c = 0u;
+ float d = 0.0f;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.spvasm
new file mode 100644
index 0000000..085f1ef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.spvasm
@@ -0,0 +1,50 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %a "a"
+ OpName %b "b"
+ OpName %c "c"
+ OpName %d "d"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %9 = OpConstantNull %bool
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Function_int = OpTypePointer Function %int
+ %14 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %19 = OpConstantNull %uint
+ %float = OpTypeFloat 32
+ %float_0 = OpConstant %float 0
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpConstantNull %float
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %a = OpVariable %_ptr_Function_bool Function %9
+ %b = OpVariable %_ptr_Function_int Function %14
+ %c = OpVariable %_ptr_Function_uint Function %19
+ %d = OpVariable %_ptr_Function_float Function %24
+ OpStore %a %false
+ OpStore %b %int_0
+ OpStore %c %uint_0
+ OpStore %d %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.wgsl
new file mode 100644
index 0000000..2e764c2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var a : bool = false;
+ var b : i32 = 0;
+ var c : u32 = 0u;
+ var d : f32 = 0.0;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm
new file mode 100644
index 0000000..ed77aa2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %S "S"
+OpName %S_0 "S"
+OpMemberName %S 0 "algo"
+OpMemberName %S_0 0 "rithm"
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%S = OpTypeStruct %uint
+%S_0 = OpTypeStruct %uint
+%_ptr_Function_S = OpTypePointer Function %S
+%_ptr_Function_S_0 = OpTypePointer Function %S_0
+%100 = OpFunction %void None %4
+%39 = OpLabel
+%40 = OpVariable %_ptr_Function_S Function
+%41 = OpVariable %_ptr_Function_S_0 Function
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.hlsl
new file mode 100644
index 0000000..b9c297e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+struct S {
+ uint algo;
+};
+struct S_1 {
+ uint rithm;
+};
+
+void main_1() {
+ S x_40 = (S)0;
+ S_1 x_41 = (S_1)0;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.msl
new file mode 100644
index 0000000..98d5b76
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ uint algo;
+};
+struct S_1 {
+ uint rithm;
+};
+
+void main_1() {
+ S x_40 = {};
+ S_1 x_41 = {};
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.spvasm
new file mode 100644
index 0000000..66cb234
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.spvasm
@@ -0,0 +1,39 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %S "S"
+ OpMemberName %S 0 "algo"
+ OpName %x_40 "x_40"
+ OpName %S_1 "S_1"
+ OpMemberName %S_1 0 "rithm"
+ OpName %x_41 "x_41"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S_1 0 Offset 0
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %S = OpTypeStruct %uint
+%_ptr_Function_S = OpTypePointer Function %S
+ %9 = OpConstantNull %S
+ %S_1 = OpTypeStruct %uint
+%_ptr_Function_S_1 = OpTypePointer Function %S_1
+ %13 = OpConstantNull %S_1
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_40 = OpVariable %_ptr_Function_S Function %9
+ %x_41 = OpVariable %_ptr_Function_S_1 Function %13
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.wgsl
new file mode 100644
index 0000000..541f264
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+struct S {
+ algo : u32;
+};
+
+struct S_1 {
+ rithm : u32;
+};
+
+fn main_1() {
+ var x_40 : S;
+ var x_41 : S_1;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm
new file mode 100644
index 0000000..a07c031
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%28 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_30 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Function__struct_30 = OpTypePointer Function %_struct_30
+%uint_2_0 = OpConstant %uint 2
+%33 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2_0
+%34 = OpConstantComposite %_struct_30 %uint_1 %float_1_5 %33
+%100 = OpFunction %void None %2
+%35 = OpLabel
+%200 = OpVariable %_ptr_Function__struct_30 Function %34
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..a7c957d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+struct S {
+ uint field0;
+ float field1;
+ uint field2[2];
+};
+
+void main_1() {
+ const uint tint_symbol[2] = {1u, 2u};
+ S x_200 = {1u, 1.5f, tint_symbol};
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..ac9741f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ tint_array_wrapper const tint_symbol_1 = {.arr={1u, 2u}};
+ S x_200 = {.field0=1u, .field1=1.5f, .field2=tint_symbol_1};
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..bab5b05
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpName %x_200 "x_200"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 2 Offset 8
+ OpDecorate %_arr_uint_uint_2 ArrayStride 4
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %S = OpTypeStruct %uint %float %_arr_uint_uint_2
+ %uint_1 = OpConstant %uint 1
+ %float_1_5 = OpConstant %float 1.5
+ %12 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2
+ %13 = OpConstantComposite %S %uint_1 %float_1_5 %12
+%_ptr_Function_S = OpTypePointer Function %S
+ %16 = OpConstantNull %S
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_200 = OpVariable %_ptr_Function_S Function %16
+ OpStore %x_200 %13
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..babd224
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_200 : S = S(1u, 1.5, array<u32, 2>(1u, 2u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm
new file mode 100644
index 0000000..46047cb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%28 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_30 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Function__struct_30 = OpTypePointer Function %_struct_30
+%uint_2_0 = OpConstant %uint 2
+%33 = OpConstantComposite %_arr_uint_uint_2 %uint_1 %uint_2_0
+%34 = OpConstantNull %_struct_30
+%100 = OpFunction %void None %2
+%35 = OpLabel
+%200 = OpVariable %_ptr_Function__struct_30 Function %34
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.hlsl
new file mode 100644
index 0000000..272f716
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+struct S {
+ uint field0;
+ float field1;
+ uint field2[2];
+};
+
+void main_1() {
+ const uint tint_symbol[2] = {0u, 0u};
+ S x_200 = {0u, 0.0f, tint_symbol};
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.msl
new file mode 100644
index 0000000..81ee737
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ tint_array_wrapper const tint_symbol_1 = {.arr={0u, 0u}};
+ S x_200 = {.field0=0u, .field1=0.0f, .field2=tint_symbol_1};
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.spvasm
new file mode 100644
index 0000000..e406537
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpName %x_200 "x_200"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 2 Offset 8
+ OpDecorate %_arr_uint_uint_2 ArrayStride 4
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %S = OpTypeStruct %uint %float %_arr_uint_uint_2
+ %uint_0 = OpConstant %uint 0
+ %float_0 = OpConstant %float 0
+ %12 = OpConstantComposite %_arr_uint_uint_2 %uint_0 %uint_0
+ %13 = OpConstantComposite %S %uint_0 %float_0 %12
+%_ptr_Function_S = OpTypePointer Function %S
+ %16 = OpConstantNull %S
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_200 = OpVariable %_ptr_Function_S Function %16
+ OpStore %x_200 %13
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.wgsl
new file mode 100644
index 0000000..a055f58
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_200 : S = S(0u, 0.0, array<u32, 2>(0u, 0u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm
new file mode 100644
index 0000000..74d2c51
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%28 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_30 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%float_2 = OpConstant %float 2
+%33 = OpConstantComposite %v2float %float_1_5 %float_2
+%100 = OpFunction %void None %2
+%34 = OpLabel
+%200 = OpVariable %_ptr_Function_v2float Function %33
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.hlsl
new file mode 100644
index 0000000..4121d17
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ float2 x_200 = float2(1.5f, 2.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.msl
new file mode 100644
index 0000000..21611db
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ float2 x_200 = float2(1.5f, 2.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.spvasm
new file mode 100644
index 0000000..dce6b4e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_200 "x_200"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_1_5 = OpConstant %float 1.5
+ %float_2 = OpConstant %float 2
+ %9 = OpConstantComposite %v2float %float_1_5 %float_2
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %12 = OpConstantNull %v2float
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_200 = OpVariable %_ptr_Function_v2float Function %12
+ OpStore %x_200 %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.wgsl
new file mode 100644
index 0000000..ae3b881
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_200 : vec2<f32> = vec2<f32>(1.5, 2.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm
new file mode 100644
index 0000000..269e7b6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm
@@ -0,0 +1,70 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%34 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_36 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Private_uint = OpTypePointer Private %uint
+%1 = OpVariable %_ptr_Private_uint Private
+%100 = OpFunction %void None %6
+%3 = OpLabel
+OpStore %1 %uint_0
+OpBranch %5
+%5 = OpLabel
+OpStore %1 %uint_1
+OpLoopMerge %99 %80 None
+OpBranchConditional %false %99 %20
+%20 = OpLabel
+OpStore %1 %uint_3
+OpSelectionMerge %50 None
+OpBranchConditional %true %30 %40
+%30 = OpLabel
+%2 = OpIAdd %uint %uint_1 %uint_1
+OpBranch %50
+%40 = OpLabel
+OpReturn
+%50 = OpLabel
+OpStore %1 %2
+OpBranch %80
+%80 = OpLabel
+OpStore %1 %uint_4
+OpBranchConditional %false %99 %5
+%99 = OpLabel
+OpStore %1 %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.hlsl
new file mode 100644
index 0000000..78e55ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+static uint x_1 = 0u;
+
+void main_1() {
+ x_1 = 0u;
+ while (true) {
+ uint x_2 = 0u;
+ x_1 = 1u;
+ if (false) {
+ break;
+ }
+ x_1 = 3u;
+ if (true) {
+ x_2 = (1u + 1u);
+ } else {
+ return;
+ }
+ x_1 = x_2;
+ {
+ x_1 = 4u;
+ if (false) {
+ break;
+ }
+ }
+ }
+ x_1 = 5u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.msl
new file mode 100644
index 0000000..ae93b02
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.msl
@@ -0,0 +1,44 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 0u;
+ while (true) {
+ uint x_2 = 0u;
+ *(tint_symbol_1) = 1u;
+ if (false) {
+ break;
+ }
+ *(tint_symbol_1) = 3u;
+ if (true) {
+ x_2 = (1u + 1u);
+ } else {
+ return;
+ }
+ *(tint_symbol_1) = x_2;
+ {
+ *(tint_symbol_1) = 4u;
+ if (false) {
+ break;
+ }
+ }
+ }
+ *(tint_symbol_1) = 5u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.wgsl
new file mode 100644
index 0000000..9e59f91
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.wgsl
@@ -0,0 +1,39 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+var<private> x_1 : u32;
+
+fn main_1() {
+ x_1 = 0u;
+ loop {
+ var x_2 : u32;
+ x_1 = 1u;
+ if (false) {
+ break;
+ }
+ x_1 = 3u;
+ if (true) {
+ x_2 = (1u + 1u);
+ } else {
+ return;
+ }
+ x_1 = x_2;
+
+ continuing {
+ x_1 = 4u;
+ if (false) {
+ break;
+ }
+ }
+ }
+ x_1 = 5u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm
new file mode 100644
index 0000000..c6c0181
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_34 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%true_0 = OpConstantTrue %bool
+%100 = OpFunction %void None %4
+%10 = OpLabel
+%1 = OpCopyObject %uint %uint_1
+%2 = OpCopyObject %uint %1
+OpSelectionMerge %99 None
+OpBranchConditional %true_0 %20 %99
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..0cf1714
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ const uint x_2 = 1u;
+ if (true) {
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.msl
new file mode 100644
index 0000000..1f3d451
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ uint const x_1 = 1u;
+ uint const x_2 = x_1;
+ if (true) {
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..17bb5e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpSelectionMerge %9 None
+ OpBranchConditional %true %10 %9
+ %10 = OpLabel
+ OpBranch %9
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..f557570
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ let x_1 : u32 = 1u;
+ let x_2 : u32 = x_1;
+ if (true) {
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm
new file mode 100644
index 0000000..ec5a343
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm
@@ -0,0 +1,56 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_34 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Private_uint = OpTypePointer Private %uint
+%200 = OpVariable %_ptr_Private_uint Private
+%true_0 = OpConstantTrue %bool
+%100 = OpFunction %void None %4
+%10 = OpLabel
+%1 = OpCopyObject %uint %uint_1
+OpSelectionMerge %99 None
+OpBranchConditional %true_0 %20 %99
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+%3 = OpCopyObject %uint %1
+OpStore %200 %3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.hlsl
new file mode 100644
index 0000000..d1cbc4c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+static uint x_200 = 0u;
+
+void main_1() {
+ const uint x_1 = 1u;
+ if (true) {
+ }
+ x_200 = x_1;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.msl
new file mode 100644
index 0000000..73ae2f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1(thread uint* const tint_symbol_1) {
+ uint const x_1 = 1u;
+ if (true) {
+ }
+ uint const x_3 = x_1;
+ *(tint_symbol_1) = x_3;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.spvasm
new file mode 100644
index 0000000..8a25980
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_200 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %12 None
+ OpBranchConditional %true %13 %12
+ %13 = OpLabel
+ OpBranch %12
+ %12 = OpLabel
+ OpStore %x_200 %uint_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.wgsl
new file mode 100644
index 0000000..6e48a90
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.wgsl
@@ -0,0 +1,21 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+var<private> x_200 : u32;
+
+fn main_1() {
+ let x_1 : u32 = 1u;
+ if (true) {
+ }
+ let x_3 : u32 = x_1;
+ x_200 = x_3;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm
new file mode 100644
index 0000000..bb8a82f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm
@@ -0,0 +1,61 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_35 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Private_uint = OpTypePointer Private %uint
+%200 = OpVariable %_ptr_Private_uint Private
+%true_0 = OpConstantTrue %bool
+%100 = OpFunction %void None %4
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %true_0 %20 %99
+%20 = OpLabel
+%1 = OpCopyObject %uint %uint_1
+OpSelectionMerge %89 None
+OpBranchConditional %true_0 %30 %89
+%30 = OpLabel
+OpBranch %89
+%89 = OpLabel
+%3 = OpCopyObject %uint %1
+OpStore %200 %3
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..f541cf6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+static uint x_200 = 0u;
+
+void main_1() {
+ if (true) {
+ const uint x_1 = 1u;
+ if (true) {
+ }
+ x_200 = x_1;
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.msl
new file mode 100644
index 0000000..eda2ef3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1(thread uint* const tint_symbol_1) {
+ if (true) {
+ uint const x_1 = 1u;
+ if (true) {
+ }
+ uint const x_3 = x_1;
+ *(tint_symbol_1) = x_3;
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..1f2f212
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.spvasm
@@ -0,0 +1,41 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_200 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %true %12 %11
+ %12 = OpLabel
+ OpSelectionMerge %14 None
+ OpBranchConditional %true %15 %14
+ %15 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpStore %x_200 %uint_1
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..39a6957
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.wgsl
@@ -0,0 +1,23 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+var<private> x_200 : u32;
+
+fn main_1() {
+ if (true) {
+ let x_1 : u32 = 1u;
+ if (true) {
+ }
+ let x_3 : u32 = x_1;
+ x_200 = x_3;
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm
new file mode 100644
index 0000000..66de322
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm
@@ -0,0 +1,61 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_35 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Private_uint = OpTypePointer Private %uint
+%200 = OpVariable %_ptr_Private_uint Private
+%true_0 = OpConstantTrue %bool
+%100 = OpFunction %void None %4
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpBranchConditional %true_0 %20 %99
+%20 = OpLabel
+%1 = OpCopyObject %uint %uint_1
+OpSelectionMerge %89 None
+OpSwitch %uint_1 %89 0 %30
+%30 = OpLabel
+OpBranch %89
+%89 = OpLabel
+%3 = OpCopyObject %uint %1
+OpStore %200 %3
+OpBranch %99
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.hlsl
new file mode 100644
index 0000000..0f61ca0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.hlsl
@@ -0,0 +1,22 @@
+static uint x_200 = 0u;
+
+void main_1() {
+ if (true) {
+ const uint x_1 = 1u;
+ switch(1u) {
+ case 0u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ x_200 = x_1;
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.msl
new file mode 100644
index 0000000..4711ae1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1(thread uint* const tint_symbol_1) {
+ if (true) {
+ uint const x_1 = 1u;
+ switch(1u) {
+ case 0u: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ uint const x_3 = x_1;
+ *(tint_symbol_1) = x_3;
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.spvasm
new file mode 100644
index 0000000..c7250dd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.spvasm
@@ -0,0 +1,43 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_200 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %true %12 %11
+ %12 = OpLabel
+ OpSelectionMerge %14 None
+ OpSwitch %uint_1 %15 0 %16
+ %16 = OpLabel
+ OpBranch %14
+ %15 = OpLabel
+ OpBranch %14
+ %14 = OpLabel
+ OpStore %x_200 %uint_1
+ OpBranch %11
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.wgsl
new file mode 100644
index 0000000..02ec62d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.wgsl
@@ -0,0 +1,27 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+var<private> x_200 : u32;
+
+fn main_1() {
+ if (true) {
+ let x_1 : u32 = 1u;
+ switch(1u) {
+ case 0u: {
+ }
+ default: {
+ }
+ }
+ let x_3 : u32 = x_1;
+ x_200 = x_3;
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm
new file mode 100644
index 0000000..f17c229
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_34 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%100 = OpFunction %void None %3
+%10 = OpLabel
+%25 = OpVariable %_ptr_Function_uint Function
+%2 = OpIAdd %uint %uint_1 %uint_1
+OpStore %25 %uint_1
+OpBranch %20
+%20 = OpLabel
+OpStore %25 %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.hlsl
new file mode 100644
index 0000000..d8166c5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ uint x_25 = 0u;
+ x_25 = 1u;
+ x_25 = (1u + 1u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.msl
new file mode 100644
index 0000000..a30ed6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ uint x_25 = 0u;
+ x_25 = 1u;
+ x_25 = (1u + 1u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.spvasm
new file mode 100644
index 0000000..87ef5ae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_25 "x_25"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %8 = OpConstantNull %uint
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_25 = OpVariable %_ptr_Function_uint Function %8
+ OpStore %x_25 %uint_1
+ %10 = OpIAdd %uint %uint_1 %uint_1
+ OpStore %x_25 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.wgsl
new file mode 100644
index 0000000..8fca7f2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_25 : u32;
+ x_25 = 1u;
+ x_25 = (1u + 1u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm
new file mode 100644
index 0000000..f3a6fd6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm
@@ -0,0 +1,57 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_34 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%100 = OpFunction %void None %3
+%10 = OpLabel
+%25 = OpVariable %_ptr_Function_uint Function
+%2 = OpIAdd %uint %uint_1 %uint_1
+OpStore %25 %uint_1
+OpBranch %20
+%20 = OpLabel
+OpLoopMerge %99 %80 None
+OpBranch %80
+%80 = OpLabel
+OpStore %25 %2
+OpBranch %20
+%99 = OpLabel
+OpStore %25 %uint_2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.hlsl
new file mode 100644
index 0000000..549e996
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+void main_1() {
+ uint x_25 = 0u;
+ const uint x_2 = (1u + 1u);
+ x_25 = 1u;
+ while (true) {
+ {
+ x_25 = x_2;
+ }
+ }
+ x_25 = 2u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.msl
new file mode 100644
index 0000000..223c46e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ uint x_25 = 0u;
+ uint const x_2 = (1u + 1u);
+ x_25 = 1u;
+ while (true) {
+ {
+ x_25 = x_2;
+ }
+ }
+ x_25 = 2u;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.spvasm
new file mode 100644
index 0000000..c6832a8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_25 "x_25"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %8 = OpConstantNull %uint
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_25 = OpVariable %_ptr_Function_uint Function %8
+ %10 = OpIAdd %uint %uint_1 %uint_1
+ OpStore %x_25 %uint_1
+ OpBranch %11
+ %11 = OpLabel
+ OpLoopMerge %12 %13 None
+ OpBranch %14
+ %14 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ OpStore %x_25 %10
+ OpBranch %11
+ %12 = OpLabel
+ OpStore %x_25 %uint_2
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.wgsl
new file mode 100644
index 0000000..9dac7e4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_25 : u32;
+ let x_2 : u32 = (1u + 1u);
+ x_25 = 1u;
+ loop {
+
+ continuing {
+ x_25 = x_2;
+ }
+ }
+ x_25 = 2u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm
new file mode 100644
index 0000000..42b5933
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm
@@ -0,0 +1,52 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_34 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%100 = OpFunction %void None %3
+%10 = OpLabel
+%25 = OpVariable %_ptr_Function_uint Function
+%2 = OpIAdd %uint %uint_1 %uint_1
+OpStore %25 %uint_1
+OpBranch %20
+%20 = OpLabel
+OpStore %25 %2
+OpStore %25 %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.hlsl
new file mode 100644
index 0000000..44decb4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+void main_1() {
+ uint x_25 = 0u;
+ const uint x_2 = (1u + 1u);
+ x_25 = 1u;
+ x_25 = x_2;
+ x_25 = x_2;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.msl
new file mode 100644
index 0000000..c207f56
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ uint x_25 = 0u;
+ uint const x_2 = (1u + 1u);
+ x_25 = 1u;
+ x_25 = x_2;
+ x_25 = x_2;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.spvasm
new file mode 100644
index 0000000..8dce044
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_25 "x_25"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %8 = OpConstantNull %uint
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_25 = OpVariable %_ptr_Function_uint Function %8
+ %10 = OpIAdd %uint %uint_1 %uint_1
+ OpStore %x_25 %uint_1
+ OpStore %x_25 %10
+ OpStore %x_25 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.wgsl
new file mode 100644
index 0000000..abec2fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_25 : u32;
+ let x_2 : u32 = (1u + 1u);
+ x_25 = 1u;
+ x_25 = x_2;
+ x_25 = x_2;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm
new file mode 100644
index 0000000..1eea7ea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 202
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%31 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_33 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%100 = OpFunction %void None %2
+%10 = OpLabel
+OpSelectionMerge %50 None
+OpBranchConditional %true %20 %30
+%20 = OpLabel
+%200 = OpCompositeInsert %v2int %int_0 %31 0
+OpBranch %50
+%30 = OpLabel
+OpReturn
+%50 = OpLabel
+%201 = OpCopyObject %v2int %200
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.hlsl
new file mode 100644
index 0000000..ded87d7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+void main_1() {
+ int2 x_200 = int2(0, 0);
+ if (true) {
+ x_200 = int2(0, 0);
+ x_200.x = 0;
+ } else {
+ return;
+ }
+ const int2 x_201 = x_200;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.msl
new file mode 100644
index 0000000..0c1053a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ int2 x_200 = 0;
+ if (true) {
+ x_200 = int2(0, 0);
+ x_200.x = 0;
+ } else {
+ return;
+ }
+ int2 const x_201 = x_200;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.spvasm
new file mode 100644
index 0000000..df3fb8b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.spvasm
@@ -0,0 +1,46 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_200 "x_200"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %9 = OpConstantNull %v2int
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %int_0 = OpConstant %int 0
+ %16 = OpConstantComposite %v2int %int_0 %int_0
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_Function_int = OpTypePointer Function %int
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_200 = OpVariable %_ptr_Function_v2int Function %9
+ OpSelectionMerge %12 None
+ OpBranchConditional %true %13 %14
+ %13 = OpLabel
+ OpStore %x_200 %16
+ %20 = OpAccessChain %_ptr_Function_int %x_200 %uint_0
+ OpStore %20 %int_0
+ OpBranch %12
+ %14 = OpLabel
+ OpReturn
+ %12 = OpLabel
+ %21 = OpLoad %v2int %x_200
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.wgsl
new file mode 100644
index 0000000..748c68e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_200 : vec2<i32>;
+ if (true) {
+ x_200 = vec2<i32>(0, 0);
+ x_200.x = 0;
+ } else {
+ return;
+ }
+ let x_201 : vec2<i32> = x_200;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm
new file mode 100644
index 0000000..ce15896
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm
@@ -0,0 +1,60 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 503
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%31 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_33 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%34 = OpTypeFunction %void %int
+%500 = OpFunction %void None %34
+%501 = OpFunctionParameter %int
+%502 = OpLabel
+OpReturn
+OpFunctionEnd
+%100 = OpFunction %void None %2
+%10 = OpLabel
+OpSelectionMerge %50 None
+OpBranchConditional %true %20 %30
+%20 = OpLabel
+%200 = OpCopyObject %int %int_1
+OpBranch %50
+%30 = OpLabel
+OpReturn
+%50 = OpLabel
+%201 = OpFunctionCall %void %500 %200
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.hlsl
new file mode 100644
index 0000000..f9805b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+void x_500(int x_501) {
+ return;
+}
+
+void main_1() {
+ int x_200 = 0;
+ if (true) {
+ x_200 = 1;
+ } else {
+ return;
+ }
+ x_500(x_200);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.msl
new file mode 100644
index 0000000..ffc6cb2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.msl
@@ -0,0 +1,32 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void x_500(int x_501) {
+ return;
+}
+
+void main_1() {
+ int x_200 = 0;
+ if (true) {
+ x_200 = 1;
+ } else {
+ return;
+ }
+ x_500(x_200);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.spvasm
new file mode 100644
index 0000000..9c75a61
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.spvasm
@@ -0,0 +1,48 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_500 "x_500"
+ OpName %x_501 "x_501"
+ OpName %main_1 "main_1"
+ OpName %x_200 "x_200"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %int = OpTypeInt 32 1
+ %1 = OpTypeFunction %void %int
+ %7 = OpTypeFunction %void
+%_ptr_Function_int = OpTypePointer Function %int
+ %12 = OpConstantNull %int
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %int_1 = OpConstant %int 1
+ %x_500 = OpFunction %void None %1
+ %x_501 = OpFunctionParameter %int
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main_1 = OpFunction %void None %7
+ %9 = OpLabel
+ %x_200 = OpVariable %_ptr_Function_int Function %12
+ OpSelectionMerge %15 None
+ OpBranchConditional %true %16 %17
+ %16 = OpLabel
+ OpStore %x_200 %int_1
+ OpBranch %15
+ %17 = OpLabel
+ OpReturn
+ %15 = OpLabel
+ %20 = OpLoad %int %x_200
+ %19 = OpFunctionCall %void %x_500 %20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.wgsl
new file mode 100644
index 0000000..99f2a9a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn x_500(x_501 : i32) {
+ return;
+}
+
+fn main_1() {
+ var x_200 : i32;
+ if (true) {
+ x_200 = 1;
+ } else {
+ return;
+ }
+ x_500(x_200);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm
new file mode 100644
index 0000000..26ffbf1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm
@@ -0,0 +1,54 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 202
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%31 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_33 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%100 = OpFunction %void None %2
+%10 = OpLabel
+OpSelectionMerge %50 None
+OpBranchConditional %true %20 %30
+%20 = OpLabel
+%200 = OpVectorInsertDynamic %v2int %31 %int_3 %int_1
+OpBranch %50
+%30 = OpLabel
+OpReturn
+%50 = OpLabel
+%201 = OpCopyObject %v2int %200
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.hlsl
new file mode 100644
index 0000000..305aab8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+void main_1() {
+ int2 x_200 = int2(0, 0);
+ if (true) {
+ x_200 = int2(0, 0);
+ x_200[1] = 3;
+ } else {
+ return;
+ }
+ const int2 x_201 = x_200;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.msl
new file mode 100644
index 0000000..9dd20f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ int2 x_200 = 0;
+ if (true) {
+ x_200 = int2(0, 0);
+ x_200[1] = 3;
+ } else {
+ return;
+ }
+ int2 const x_201 = x_200;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.spvasm
new file mode 100644
index 0000000..8f2e929
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.spvasm
@@ -0,0 +1,46 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_200 "x_200"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %9 = OpConstantNull %v2int
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %int_0 = OpConstant %int 0
+ %16 = OpConstantComposite %v2int %int_0 %int_0
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %int_3 = OpConstant %int 3
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_200 = OpVariable %_ptr_Function_v2int Function %9
+ OpSelectionMerge %12 None
+ OpBranchConditional %true %13 %14
+ %13 = OpLabel
+ OpStore %x_200 %16
+ %19 = OpAccessChain %_ptr_Function_int %x_200 %int_1
+ OpStore %19 %int_3
+ OpBranch %12
+ %14 = OpLabel
+ OpReturn
+ %12 = OpLabel
+ %21 = OpLoad %v2int %x_200
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.wgsl
new file mode 100644
index 0000000..f14ee09
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_200 : vec2<i32>;
+ if (true) {
+ x_200 = vec2<i32>(0, 0);
+ x_200[1] = 3;
+ } else {
+ return;
+ }
+ let x_201 : vec2<i32> = x_200;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm
new file mode 100644
index 0000000..8c3d4a6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm
@@ -0,0 +1,70 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 103
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%36 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_38 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Private_uint = OpTypePointer Private %uint
+%1 = OpVariable %_ptr_Private_uint Private
+%_ptr_Private_bool = OpTypePointer Private %bool
+%7 = OpVariable %_ptr_Private_bool Private
+%8 = OpVariable %_ptr_Private_bool Private
+%100 = OpFunction %void None %4
+%5 = OpLabel
+%101 = OpLoad %bool %7
+%102 = OpLoad %bool %8
+OpBranch %10
+%10 = OpLabel
+OpLoopMerge %99 %89 None
+OpBranchConditional %101 %99 %20
+%20 = OpLabel
+OpSelectionMerge %79 None
+OpBranchConditional %102 %30 %40
+%30 = OpLabel
+OpBranch %89
+%40 = OpLabel
+OpBranch %89
+%79 = OpLabel
+OpBranch %89
+%89 = OpLabel
+%2 = OpPhi %uint %uint_0 %30 %uint_1 %40 %uint_0 %79
+OpStore %1 %2
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.hlsl
new file mode 100644
index 0000000..7e545e0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.hlsl
@@ -0,0 +1,37 @@
+static uint x_1 = 0u;
+static bool x_7 = false;
+static bool x_8 = false;
+
+void main_1() {
+ const bool x_101 = x_7;
+ const bool x_102 = x_8;
+ while (true) {
+ uint x_2_phi = 0u;
+ if (x_101) {
+ break;
+ }
+ if (x_102) {
+ x_2_phi = 0u;
+ {
+ x_1 = x_2_phi;
+ }
+ continue;
+ } else {
+ x_2_phi = 1u;
+ {
+ x_1 = x_2_phi;
+ }
+ continue;
+ }
+ x_2_phi = 0u;
+ {
+ x_1 = x_2_phi;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.msl
new file mode 100644
index 0000000..04dbbd5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.msl
@@ -0,0 +1,52 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1(thread bool* const tint_symbol_1, thread bool* const tint_symbol_2, thread uint* const tint_symbol_3) {
+ bool const x_101 = *(tint_symbol_1);
+ bool const x_102 = *(tint_symbol_2);
+ while (true) {
+ uint x_2_phi = 0u;
+ if (x_101) {
+ break;
+ }
+ if (x_102) {
+ x_2_phi = 0u;
+ {
+ uint const x_2 = x_2_phi;
+ *(tint_symbol_3) = x_2;
+ }
+ continue;
+ } else {
+ x_2_phi = 1u;
+ {
+ uint const x_2 = x_2_phi;
+ *(tint_symbol_3) = x_2;
+ }
+ continue;
+ }
+ x_2_phi = 0u;
+ {
+ uint const x_2 = x_2_phi;
+ *(tint_symbol_3) = x_2;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread bool tint_symbol_4 = false;
+ thread bool tint_symbol_5 = false;
+ thread uint tint_symbol_6 = 0u;
+ main_1(&(tint_symbol_4), &(tint_symbol_5), &(tint_symbol_6));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.spvasm
new file mode 100644
index 0000000..8d90b52
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %x_7 "x_7"
+ OpName %x_8 "x_8"
+ OpName %main_1 "main_1"
+ OpName %x_2_phi "x_2_phi"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+ %bool = OpTypeBool
+%_ptr_Private_bool = OpTypePointer Private %bool
+ %8 = OpConstantNull %bool
+ %x_7 = OpVariable %_ptr_Private_bool Private %8
+ %x_8 = OpVariable %_ptr_Private_bool Private %8
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %x_2_phi = OpVariable %_ptr_Function_uint Function %4
+ %14 = OpLoad %bool %x_7
+ %15 = OpLoad %bool %x_8
+ OpBranch %16
+ %16 = OpLabel
+ OpLoopMerge %17 %18 None
+ OpBranch %19
+ %19 = OpLabel
+ OpSelectionMerge %22 None
+ OpBranchConditional %14 %23 %22
+ %23 = OpLabel
+ OpBranch %17
+ %22 = OpLabel
+ OpSelectionMerge %24 None
+ OpBranchConditional %15 %25 %26
+ %25 = OpLabel
+ OpStore %x_2_phi %uint_0
+ OpBranch %18
+ %26 = OpLabel
+ OpStore %x_2_phi %uint_1
+ OpBranch %18
+ %24 = OpLabel
+ OpStore %x_2_phi %uint_0
+ OpBranch %18
+ %18 = OpLabel
+ %29 = OpLoad %uint %x_2_phi
+ OpStore %x_1 %29
+ OpBranch %16
+ %17 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.wgsl
new file mode 100644
index 0000000..b4f1c80
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.wgsl
@@ -0,0 +1,41 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+var<private> x_1 : u32;
+
+var<private> x_7 : bool;
+
+var<private> x_8 : bool;
+
+fn main_1() {
+ let x_101 : bool = x_7;
+ let x_102 : bool = x_8;
+ loop {
+ var x_2_phi : u32;
+ if (x_101) {
+ break;
+ }
+ if (x_102) {
+ x_2_phi = 0u;
+ continue;
+ } else {
+ x_2_phi = 1u;
+ continue;
+ }
+ x_2_phi = 0u;
+
+ continuing {
+ let x_2 : u32 = x_2_phi;
+ x_1 = x_2;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm
new file mode 100644
index 0000000..b433f10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm
@@ -0,0 +1,68 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 103
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%36 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_38 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Private_uint = OpTypePointer Private %uint
+%1 = OpVariable %_ptr_Private_uint Private
+%_ptr_Private_bool = OpTypePointer Private %bool
+%7 = OpVariable %_ptr_Private_bool Private
+%8 = OpVariable %_ptr_Private_bool Private
+%100 = OpFunction %void None %4
+%5 = OpLabel
+%101 = OpLoad %bool %7
+%102 = OpLoad %bool %8
+OpBranch %10
+%10 = OpLabel
+OpLoopMerge %99 %89 None
+OpBranchConditional %101 %99 %20
+%20 = OpLabel
+OpSelectionMerge %79 None
+OpBranchConditional %102 %30 %89
+%30 = OpLabel
+OpBranch %89
+%79 = OpLabel
+OpUnreachable
+%89 = OpLabel
+%2 = OpPhi %uint %uint_0 %20 %uint_1 %30
+OpStore %1 %2
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.hlsl
new file mode 100644
index 0000000..5d03e49
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.hlsl
@@ -0,0 +1,37 @@
+static uint x_1 = 0u;
+static bool x_7 = false;
+static bool x_8 = false;
+
+void main_1() {
+ const bool x_101 = x_7;
+ const bool x_102 = x_8;
+ while (true) {
+ uint x_2_phi = 0u;
+ if (x_101) {
+ break;
+ }
+ x_2_phi = 0u;
+ if (x_102) {
+ x_2_phi = 1u;
+ {
+ x_1 = x_2_phi;
+ }
+ continue;
+ } else {
+ {
+ x_1 = x_2_phi;
+ }
+ continue;
+ }
+ return;
+ {
+ x_1 = x_2_phi;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.msl
new file mode 100644
index 0000000..b80683d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.msl
@@ -0,0 +1,52 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1(thread bool* const tint_symbol_1, thread bool* const tint_symbol_2, thread uint* const tint_symbol_3) {
+ bool const x_101 = *(tint_symbol_1);
+ bool const x_102 = *(tint_symbol_2);
+ while (true) {
+ uint x_2_phi = 0u;
+ if (x_101) {
+ break;
+ }
+ x_2_phi = 0u;
+ if (x_102) {
+ x_2_phi = 1u;
+ {
+ uint const x_2 = x_2_phi;
+ *(tint_symbol_3) = x_2;
+ }
+ continue;
+ } else {
+ {
+ uint const x_2 = x_2_phi;
+ *(tint_symbol_3) = x_2;
+ }
+ continue;
+ }
+ return;
+ {
+ uint const x_2 = x_2_phi;
+ *(tint_symbol_3) = x_2;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread bool tint_symbol_4 = false;
+ thread bool tint_symbol_5 = false;
+ thread uint tint_symbol_6 = 0u;
+ main_1(&(tint_symbol_4), &(tint_symbol_5), &(tint_symbol_6));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.spvasm
new file mode 100644
index 0000000..d930c87
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %x_7 "x_7"
+ OpName %x_8 "x_8"
+ OpName %main_1 "main_1"
+ OpName %x_2_phi "x_2_phi"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+ %bool = OpTypeBool
+%_ptr_Private_bool = OpTypePointer Private %bool
+ %8 = OpConstantNull %bool
+ %x_7 = OpVariable %_ptr_Private_bool Private %8
+ %x_8 = OpVariable %_ptr_Private_bool Private %8
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %x_2_phi = OpVariable %_ptr_Function_uint Function %4
+ %14 = OpLoad %bool %x_7
+ %15 = OpLoad %bool %x_8
+ OpBranch %16
+ %16 = OpLabel
+ OpLoopMerge %17 %18 None
+ OpBranch %19
+ %19 = OpLabel
+ OpSelectionMerge %22 None
+ OpBranchConditional %14 %23 %22
+ %23 = OpLabel
+ OpBranch %17
+ %22 = OpLabel
+ OpStore %x_2_phi %uint_0
+ OpSelectionMerge %25 None
+ OpBranchConditional %15 %26 %27
+ %26 = OpLabel
+ OpStore %x_2_phi %uint_1
+ OpBranch %18
+ %27 = OpLabel
+ OpBranch %18
+ %25 = OpLabel
+ OpReturn
+ %18 = OpLabel
+ %29 = OpLoad %uint %x_2_phi
+ OpStore %x_1 %29
+ OpBranch %16
+ %17 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.wgsl
new file mode 100644
index 0000000..cfe9e87
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.wgsl
@@ -0,0 +1,41 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+var<private> x_1 : u32;
+
+var<private> x_7 : bool;
+
+var<private> x_8 : bool;
+
+fn main_1() {
+ let x_101 : bool = x_7;
+ let x_102 : bool = x_8;
+ loop {
+ var x_2_phi : u32;
+ if (x_101) {
+ break;
+ }
+ x_2_phi = 0u;
+ if (x_102) {
+ x_2_phi = 1u;
+ continue;
+ } else {
+ continue;
+ }
+ return;
+
+ continuing {
+ let x_2 : u32 = x_2_phi;
+ x_1 = x_2;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm
new file mode 100644
index 0000000..83d008f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm
@@ -0,0 +1,66 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%34 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_36 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%true_0 = OpConstantTrue %bool
+%_ptr_Private_uint = OpTypePointer Private %uint
+%1 = OpVariable %_ptr_Private_uint Private
+%_ptr_Private_bool = OpTypePointer Private %bool
+%7 = OpVariable %_ptr_Private_bool Private
+%8 = OpVariable %_ptr_Private_bool Private
+%100 = OpFunction %void None %3
+%10 = OpLabel
+OpSelectionMerge %99 None
+OpSwitch %uint_1 %20 0 %20 1 %30
+%20 = OpLabel
+OpBranch %30
+%30 = OpLabel
+OpSelectionMerge %50 None
+OpBranchConditional %true %40 %45
+%40 = OpLabel
+OpBranch %50
+%45 = OpLabel
+OpBranch %99
+%50 = OpLabel
+OpBranch %99
+%99 = OpLabel
+%41 = OpPhi %uint %uint_0 %45 %uint_1 %50
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.hlsl
new file mode 100644
index 0000000..8d07dd4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.hlsl
@@ -0,0 +1,31 @@
+static uint x_1 = 0u;
+static bool x_7 = false;
+static bool x_8 = false;
+
+void main_1() {
+ uint x_41_phi = 0u;
+ switch(1u) {
+ default: {
+ /* fallthrough */
+ }
+ case 0u: {
+ /* fallthrough */
+ }
+ case 1u: {
+ if (true) {
+ } else {
+ x_41_phi = 0u;
+ break;
+ }
+ x_41_phi = 1u;
+ break;
+ }
+ }
+ const uint x_41 = x_41_phi;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.msl
new file mode 100644
index 0000000..10b28b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.msl
@@ -0,0 +1,40 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ uint x_41_phi = 0u;
+ switch(1u) {
+ default: {
+ /* fallthrough */
+ }
+ case 0u: {
+ /* fallthrough */
+ }
+ case 1u: {
+ if (true) {
+ } else {
+ x_41_phi = 0u;
+ break;
+ }
+ x_41_phi = 1u;
+ break;
+ }
+ }
+ uint const x_41 = x_41_phi;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.spvasm
new file mode 100644
index 0000000..6b004bc0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.spvasm
@@ -0,0 +1,59 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %x_7 "x_7"
+ OpName %x_8 "x_8"
+ OpName %main_1 "main_1"
+ OpName %x_41_phi "x_41_phi"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+ %bool = OpTypeBool
+%_ptr_Private_bool = OpTypePointer Private %bool
+ %8 = OpConstantNull %bool
+ %x_7 = OpVariable %_ptr_Private_bool Private %8
+ %x_8 = OpVariable %_ptr_Private_bool Private %8
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %uint_1 = OpConstant %uint 1
+ %true = OpConstantTrue %bool
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %x_41_phi = OpVariable %_ptr_Function_uint Function %4
+ OpSelectionMerge %16 None
+ OpSwitch %uint_1 %18 0 %19 1 %20
+ %18 = OpLabel
+ OpBranch %19
+ %19 = OpLabel
+ OpBranch %20
+ %20 = OpLabel
+ OpSelectionMerge %22 None
+ OpBranchConditional %true %23 %24
+ %23 = OpLabel
+ OpBranch %22
+ %24 = OpLabel
+ OpStore %x_41_phi %uint_0
+ OpBranch %16
+ %22 = OpLabel
+ OpStore %x_41_phi %uint_1
+ OpBranch %16
+ %16 = OpLabel
+ %26 = OpLoad %uint %x_41_phi
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9e3c22
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.wgsl
@@ -0,0 +1,38 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+var<private> x_1 : u32;
+
+var<private> x_7 : bool;
+
+var<private> x_8 : bool;
+
+fn main_1() {
+ var x_41_phi : u32;
+ switch(1u) {
+ default: {
+ fallthrough;
+ }
+ case 0u: {
+ fallthrough;
+ }
+ case 1u: {
+ if (true) {
+ } else {
+ x_41_phi = 0u;
+ break;
+ }
+ x_41_phi = 1u;
+ }
+ }
+ let x_41 : u32 = x_41_phi;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm
new file mode 100644
index 0000000..670e9d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm
@@ -0,0 +1,69 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 103
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%9 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%38 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_40 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Private_uint = OpTypePointer Private %uint
+%1 = OpVariable %_ptr_Private_uint Private
+%_ptr_Private_bool = OpTypePointer Private %bool
+%7 = OpVariable %_ptr_Private_bool Private
+%8 = OpVariable %_ptr_Private_bool Private
+%100 = OpFunction %void None %9
+%5 = OpLabel
+OpBranch %10
+%10 = OpLabel
+%101 = OpLoad %bool %7
+%102 = OpLoad %bool %8
+OpLoopMerge %99 %89 None
+OpBranchConditional %101 %99 %20
+%20 = OpLabel
+%2 = OpPhi %uint %uint_0 %10 %4 %30
+%3 = OpPhi %uint %uint_1 %10 %3 %30
+OpLoopMerge %79 %30 None
+OpBranchConditional %102 %79 %30
+%30 = OpLabel
+%4 = OpIAdd %uint %2 %uint_1
+OpBranch %20
+%79 = OpLabel
+OpBranch %89
+%89 = OpLabel
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.hlsl
new file mode 100644
index 0000000..a28f759
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.hlsl
@@ -0,0 +1,36 @@
+static uint x_1 = 0u;
+static bool x_7 = false;
+static bool x_8 = false;
+
+void main_1() {
+ while (true) {
+ uint x_2_phi = 0u;
+ uint x_3_phi = 0u;
+ const bool x_101 = x_7;
+ const bool x_102 = x_8;
+ x_2_phi = 0u;
+ x_3_phi = 1u;
+ if (x_101) {
+ break;
+ }
+ while (true) {
+ uint x_4 = 0u;
+ const uint x_2 = x_2_phi;
+ const uint x_3 = x_3_phi;
+ if (x_102) {
+ break;
+ }
+ {
+ x_4 = (x_2 + 1u);
+ x_2_phi = x_4;
+ x_3_phi = x_3;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.msl
new file mode 100644
index 0000000..d1b9fef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.msl
@@ -0,0 +1,47 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1(thread bool* const tint_symbol_1, thread bool* const tint_symbol_2) {
+ while (true) {
+ uint x_2_phi = 0u;
+ uint x_3_phi = 0u;
+ bool const x_101 = *(tint_symbol_1);
+ bool const x_102 = *(tint_symbol_2);
+ x_2_phi = 0u;
+ x_3_phi = 1u;
+ if (x_101) {
+ break;
+ }
+ while (true) {
+ uint x_4 = 0u;
+ uint const x_2 = x_2_phi;
+ uint const x_3 = x_3_phi;
+ if (x_102) {
+ break;
+ }
+ {
+ x_4 = (x_2 + 1u);
+ x_2_phi = x_4;
+ x_3_phi = x_3;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread bool tint_symbol_3 = false;
+ thread bool tint_symbol_4 = false;
+ main_1(&(tint_symbol_3), &(tint_symbol_4));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.spvasm
new file mode 100644
index 0000000..2151604
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %x_7 "x_7"
+ OpName %x_8 "x_8"
+ OpName %main_1 "main_1"
+ OpName %x_2_phi "x_2_phi"
+ OpName %x_3_phi "x_3_phi"
+ OpName %x_4 "x_4"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+ %bool = OpTypeBool
+%_ptr_Private_bool = OpTypePointer Private %bool
+ %8 = OpConstantNull %bool
+ %x_7 = OpVariable %_ptr_Private_bool Private %8
+ %x_8 = OpVariable %_ptr_Private_bool Private %8
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %x_2_phi = OpVariable %_ptr_Function_uint Function %4
+ %x_3_phi = OpVariable %_ptr_Function_uint Function %4
+ %x_4 = OpVariable %_ptr_Function_uint Function %4
+ OpBranch %14
+ %14 = OpLabel
+ OpLoopMerge %15 %16 None
+ OpBranch %17
+ %17 = OpLabel
+ %21 = OpLoad %bool %x_7
+ %22 = OpLoad %bool %x_8
+ OpStore %x_2_phi %uint_0
+ OpStore %x_3_phi %uint_1
+ OpSelectionMerge %25 None
+ OpBranchConditional %21 %26 %25
+ %26 = OpLabel
+ OpBranch %15
+ %25 = OpLabel
+ OpBranch %27
+ %27 = OpLabel
+ OpLoopMerge %28 %29 None
+ OpBranch %30
+ %30 = OpLabel
+ %32 = OpLoad %uint %x_2_phi
+ %33 = OpLoad %uint %x_3_phi
+ OpSelectionMerge %34 None
+ OpBranchConditional %22 %35 %34
+ %35 = OpLabel
+ OpBranch %28
+ %34 = OpLabel
+ OpBranch %29
+ %29 = OpLabel
+ %36 = OpIAdd %uint %32 %uint_1
+ OpStore %x_4 %36
+ %37 = OpLoad %uint %x_4
+ OpStore %x_2_phi %37
+ OpStore %x_3_phi %33
+ OpBranch %27
+ %28 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpBranch %14
+ %15 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.wgsl
new file mode 100644
index 0000000..0cb6422
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.wgsl
@@ -0,0 +1,45 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+var<private> x_1 : u32;
+
+var<private> x_7 : bool;
+
+var<private> x_8 : bool;
+
+fn main_1() {
+ loop {
+ var x_2_phi : u32;
+ var x_3_phi : u32;
+ let x_101 : bool = x_7;
+ let x_102 : bool = x_8;
+ x_2_phi = 0u;
+ x_3_phi = 1u;
+ if (x_101) {
+ break;
+ }
+ loop {
+ var x_4 : u32;
+ let x_2 : u32 = x_2_phi;
+ let x_3 : u32 = x_3_phi;
+ if (x_102) {
+ break;
+ }
+
+ continuing {
+ x_4 = (x_2 + 1u);
+ x_2_phi = x_4;
+ x_3_phi = x_3;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm
new file mode 100644
index 0000000..15e913b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm
@@ -0,0 +1,67 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 103
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%9 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%37 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_39 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Private_uint = OpTypePointer Private %uint
+%1 = OpVariable %_ptr_Private_uint Private
+%_ptr_Private_bool = OpTypePointer Private %bool
+%7 = OpVariable %_ptr_Private_bool Private
+%8 = OpVariable %_ptr_Private_bool Private
+%100 = OpFunction %void None %9
+%5 = OpLabel
+OpBranch %10
+%10 = OpLabel
+%101 = OpLoad %bool %7
+%102 = OpLoad %bool %8
+OpLoopMerge %99 %89 None
+OpBranchConditional %101 %99 %20
+%20 = OpLabel
+%2 = OpPhi %uint %uint_0 %10 %4 %20
+%3 = OpPhi %uint %uint_1 %10 %3 %20
+%4 = OpIAdd %uint %2 %uint_1
+OpLoopMerge %79 %20 None
+OpBranchConditional %102 %79 %20
+%79 = OpLabel
+OpBranch %89
+%89 = OpLabel
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.hlsl
new file mode 100644
index 0000000..56dbd1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.hlsl
@@ -0,0 +1,31 @@
+static uint x_1 = 0u;
+static bool x_7 = false;
+static bool x_8 = false;
+
+void main_1() {
+ while (true) {
+ uint x_2_phi = 0u;
+ uint x_3_phi = 0u;
+ const bool x_101 = x_7;
+ const bool x_102 = x_8;
+ x_2_phi = 0u;
+ x_3_phi = 1u;
+ if (x_101) {
+ break;
+ }
+ while (true) {
+ const uint x_3 = x_3_phi;
+ x_2_phi = (x_2_phi + 1u);
+ x_3_phi = x_3;
+ if (x_102) {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.msl
new file mode 100644
index 0000000..148695c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.msl
@@ -0,0 +1,43 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1(thread bool* const tint_symbol_1, thread bool* const tint_symbol_2) {
+ while (true) {
+ uint x_2_phi = 0u;
+ uint x_3_phi = 0u;
+ bool const x_101 = *(tint_symbol_1);
+ bool const x_102 = *(tint_symbol_2);
+ x_2_phi = 0u;
+ x_3_phi = 1u;
+ if (x_101) {
+ break;
+ }
+ while (true) {
+ uint const x_2 = x_2_phi;
+ uint const x_3 = x_3_phi;
+ x_2_phi = (x_2 + 1u);
+ x_3_phi = x_3;
+ if (x_102) {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread bool tint_symbol_3 = false;
+ thread bool tint_symbol_4 = false;
+ main_1(&(tint_symbol_3), &(tint_symbol_4));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.spvasm
new file mode 100644
index 0000000..a265f16
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %x_7 "x_7"
+ OpName %x_8 "x_8"
+ OpName %main_1 "main_1"
+ OpName %x_2_phi "x_2_phi"
+ OpName %x_3_phi "x_3_phi"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+ %bool = OpTypeBool
+%_ptr_Private_bool = OpTypePointer Private %bool
+ %8 = OpConstantNull %bool
+ %x_7 = OpVariable %_ptr_Private_bool Private %8
+ %x_8 = OpVariable %_ptr_Private_bool Private %8
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %x_2_phi = OpVariable %_ptr_Function_uint Function %4
+ %x_3_phi = OpVariable %_ptr_Function_uint Function %4
+ OpBranch %14
+ %14 = OpLabel
+ OpLoopMerge %15 %16 None
+ OpBranch %17
+ %17 = OpLabel
+ %21 = OpLoad %bool %x_7
+ %22 = OpLoad %bool %x_8
+ OpStore %x_2_phi %uint_0
+ OpStore %x_3_phi %uint_1
+ OpSelectionMerge %25 None
+ OpBranchConditional %21 %26 %25
+ %26 = OpLabel
+ OpBranch %15
+ %25 = OpLabel
+ OpBranch %27
+ %27 = OpLabel
+ OpLoopMerge %28 %29 None
+ OpBranch %30
+ %30 = OpLabel
+ %31 = OpLoad %uint %x_2_phi
+ %32 = OpLoad %uint %x_3_phi
+ %33 = OpIAdd %uint %31 %uint_1
+ OpStore %x_2_phi %33
+ OpStore %x_3_phi %32
+ OpSelectionMerge %34 None
+ OpBranchConditional %22 %35 %34
+ %35 = OpLabel
+ OpBranch %28
+ %34 = OpLabel
+ OpBranch %29
+ %29 = OpLabel
+ OpBranch %27
+ %28 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpBranch %14
+ %15 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.wgsl
new file mode 100644
index 0000000..05b015a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.wgsl
@@ -0,0 +1,40 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+var<private> x_1 : u32;
+
+var<private> x_7 : bool;
+
+var<private> x_8 : bool;
+
+fn main_1() {
+ loop {
+ var x_2_phi : u32;
+ var x_3_phi : u32;
+ let x_101 : bool = x_7;
+ let x_102 : bool = x_8;
+ x_2_phi = 0u;
+ x_3_phi = 1u;
+ if (x_101) {
+ break;
+ }
+ loop {
+ let x_2 : u32 = x_2_phi;
+ let x_3 : u32 = x_3_phi;
+ x_2_phi = (x_2 + 1u);
+ x_3_phi = x_3;
+ if (x_102) {
+ break;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm
new file mode 100644
index 0000000..300c05a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm
@@ -0,0 +1,63 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 501
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_34 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%float_42 = OpConstant %float 42
+%36 = OpUndef %bool
+%100 = OpFunction %void None %2
+%10 = OpLabel
+OpBranch %30
+%20 = OpLabel
+%499 = OpFAdd %float %float_42 %float_42
+%500 = OpFAdd %float %499 %float_42
+OpBranch %25
+%25 = OpLabel
+OpBranch %80
+%30 = OpLabel
+OpLoopMerge %90 %80 None
+OpBranchConditional %36 %90 %40
+%40 = OpLabel
+OpBranch %90
+%80 = OpLabel
+%81 = OpPhi %float %500 %25
+OpBranch %30
+%90 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.hlsl
new file mode 100644
index 0000000..5d1e440
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ }
+ break;
+ {
+ float x_81_phi = 0.0f;
+ const float x_81 = x_81_phi;
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.msl
new file mode 100644
index 0000000..e957103
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.msl
@@ -0,0 +1,31 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ }
+ break;
+ {
+ float x_81_phi = 0.0f;
+ float const x_81 = x_81_phi;
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.spvasm
new file mode 100644
index 0000000..70ce29c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_81_phi "x_81_phi"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %float = OpTypeFloat 32
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpConstantNull %float
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_81_phi = OpVariable %_ptr_Function_float Function %16
+ OpBranch %5
+ %5 = OpLabel
+ OpLoopMerge %6 %7 None
+ OpBranch %8
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %6
+ %11 = OpLabel
+ OpBranch %6
+ %7 = OpLabel
+ %17 = OpLoad %float %x_81_phi
+ OpBranch %5
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.wgsl
new file mode 100644
index 0000000..da37a5e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.wgsl
@@ -0,0 +1,25 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ loop {
+ if (false) {
+ break;
+ }
+ break;
+
+ continuing {
+ var x_81_phi : f32;
+ let x_81 : f32 = x_81_phi;
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm
new file mode 100644
index 0000000..8ec217a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm
@@ -0,0 +1,69 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 102
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%39 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_41 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%_ptr_Private_uint = OpTypePointer Private %uint
+%1 = OpVariable %_ptr_Private_uint Private
+%_ptr_Private_bool = OpTypePointer Private %bool
+%17 = OpVariable %_ptr_Private_bool Private
+%100 = OpFunction %void None %8
+%9 = OpLabel
+%101 = OpLoad %bool %17
+OpBranch %10
+%10 = OpLabel
+OpLoopMerge %99 %89 None
+OpBranch %20
+%20 = OpLabel
+%2 = OpPhi %uint %uint_0 %10 %4 %30
+%5 = OpPhi %uint %uint_1 %10 %7 %30
+%4 = OpIAdd %uint %2 %uint_1
+%6 = OpIAdd %uint %4 %uint_1
+OpLoopMerge %79 %30 None
+OpBranchConditional %101 %79 %30
+%30 = OpLabel
+%7 = OpIAdd %uint %4 %6
+OpBranch %20
+%79 = OpLabel
+OpBranch %89
+%89 = OpLabel
+OpBranch %10
+%99 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.hlsl
new file mode 100644
index 0000000..56a9a19
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+static uint x_1 = 0u;
+static bool x_17 = false;
+
+void main_1() {
+ const bool x_101 = x_17;
+ while (true) {
+ uint x_2_phi = 0u;
+ uint x_5_phi = 0u;
+ x_2_phi = 0u;
+ x_5_phi = 1u;
+ while (true) {
+ uint x_7 = 0u;
+ const uint x_5 = x_5_phi;
+ const uint x_4 = (x_2_phi + 1u);
+ const uint x_6 = (x_4 + 1u);
+ if (x_101) {
+ break;
+ }
+ {
+ x_7 = (x_4 + x_6);
+ x_2_phi = x_4;
+ x_5_phi = x_7;
+ }
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.msl
new file mode 100644
index 0000000..d100dae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.msl
@@ -0,0 +1,44 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1(thread bool* const tint_symbol_1) {
+ bool const x_101 = *(tint_symbol_1);
+ while (true) {
+ uint x_2_phi = 0u;
+ uint x_5_phi = 0u;
+ x_2_phi = 0u;
+ x_5_phi = 1u;
+ while (true) {
+ uint x_7 = 0u;
+ uint const x_2 = x_2_phi;
+ uint const x_5 = x_5_phi;
+ uint const x_4 = (x_2 + 1u);
+ uint const x_6 = (x_4 + 1u);
+ if (x_101) {
+ break;
+ }
+ {
+ x_7 = (x_4 + x_6);
+ x_2_phi = x_4;
+ x_5_phi = x_7;
+ }
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ thread bool tint_symbol_2 = false;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.spvasm
new file mode 100644
index 0000000..dcd5119
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %x_17 "x_17"
+ OpName %main_1 "main_1"
+ OpName %x_2_phi "x_2_phi"
+ OpName %x_5_phi "x_5_phi"
+ OpName %x_7 "x_7"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+ %bool = OpTypeBool
+%_ptr_Private_bool = OpTypePointer Private %bool
+ %8 = OpConstantNull %bool
+ %x_17 = OpVariable %_ptr_Private_bool Private %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %9
+ %12 = OpLabel
+ %x_2_phi = OpVariable %_ptr_Function_uint Function %4
+ %x_5_phi = OpVariable %_ptr_Function_uint Function %4
+ %x_7 = OpVariable %_ptr_Function_uint Function %4
+ %13 = OpLoad %bool %x_17
+ OpBranch %14
+ %14 = OpLabel
+ OpLoopMerge %15 %16 None
+ OpBranch %17
+ %17 = OpLabel
+ OpStore %x_2_phi %uint_0
+ OpStore %x_5_phi %uint_1
+ OpBranch %23
+ %23 = OpLabel
+ OpLoopMerge %24 %25 None
+ OpBranch %26
+ %26 = OpLabel
+ %28 = OpLoad %uint %x_2_phi
+ %29 = OpLoad %uint %x_5_phi
+ %30 = OpIAdd %uint %28 %uint_1
+ %31 = OpIAdd %uint %30 %uint_1
+ OpSelectionMerge %32 None
+ OpBranchConditional %13 %33 %32
+ %33 = OpLabel
+ OpBranch %24
+ %32 = OpLabel
+ OpBranch %25
+ %25 = OpLabel
+ %34 = OpIAdd %uint %30 %31
+ OpStore %x_7 %34
+ OpStore %x_2_phi %30
+ %35 = OpLoad %uint %x_7
+ OpStore %x_5_phi %35
+ OpBranch %23
+ %24 = OpLabel
+ OpBranch %16
+ %16 = OpLabel
+ OpBranch %14
+ %15 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.wgsl
new file mode 100644
index 0000000..3d5749c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.wgsl
@@ -0,0 +1,41 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+var<private> x_1 : u32;
+
+var<private> x_17 : bool;
+
+fn main_1() {
+ let x_101 : bool = x_17;
+ loop {
+ var x_2_phi : u32;
+ var x_5_phi : u32;
+ x_2_phi = 0u;
+ x_5_phi = 1u;
+ loop {
+ var x_7 : u32;
+ let x_2 : u32 = x_2_phi;
+ let x_5 : u32 = x_5_phi;
+ let x_4 : u32 = (x_2 + 1u);
+ let x_6 : u32 = (x_4 + 1u);
+ if (x_101) {
+ break;
+ }
+
+ continuing {
+ x_7 = (x_4 + x_6);
+ x_2_phi = x_4;
+ x_5_phi = x_7;
+ }
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm
new file mode 100644
index 0000000..5e986de
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm
@@ -0,0 +1,53 @@
+; Test: SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 102
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%_ptr_Function_bool = OpTypePointer Function %bool
+%_ptr_Function_float = OpTypePointer Function %float
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%float_0 = OpConstant %float 0
+%float_1_5 = OpConstant %float 1.5
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%int_n1 = OpConstant %int -1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_3 = OpConstant %int 3
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantNull %v2int
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%_struct_34 = OpTypeStruct %uint %float %_arr_uint_uint_2
+%100 = OpFunction %void None %2
+%10 = OpLabel
+%11 = OpLogicalAnd %bool %true %true
+%12 = OpLogicalNot %bool %11
+OpSelectionMerge %99 None
+OpBranchConditional %true %20 %99
+%20 = OpLabel
+OpBranch %99
+%99 = OpLabel
+%101 = OpPhi %bool %11 %10 %12 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.hlsl
new file mode 100644
index 0000000..7d340d6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+void main_1() {
+ bool x_101_phi = false;
+ const bool x_11 = (true & true);
+ const bool x_12 = !(x_11);
+ x_101_phi = x_11;
+ if (true) {
+ x_101_phi = x_12;
+ }
+ const bool x_101 = x_101_phi;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.msl
new file mode 100644
index 0000000..c30c618
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+struct S {
+ uint field0;
+ float field1;
+ tint_array_wrapper field2;
+};
+
+void main_1() {
+ bool x_101_phi = false;
+ bool const x_11 = (true & true);
+ bool const x_12 = !(x_11);
+ x_101_phi = x_11;
+ if (true) {
+ x_101_phi = x_12;
+ }
+ bool const x_101 = x_101_phi;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.spvasm
new file mode 100644
index 0000000..0fc2381
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_101_phi "x_101_phi"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %8 = OpConstantNull %bool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_101_phi = OpVariable %_ptr_Function_bool Function %8
+ %10 = OpLogicalAnd %bool %true %true
+ %11 = OpLogicalNot %bool %10
+ OpStore %x_101_phi %10
+ OpSelectionMerge %12 None
+ OpBranchConditional %true %13 %12
+ %13 = OpLabel
+ OpStore %x_101_phi %11
+ OpBranch %12
+ %12 = OpLabel
+ %14 = OpLoad %bool %x_101_phi
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.wgsl
new file mode 100644
index 0000000..e1f35fc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+ field2 : array<u32, 2>;
+};
+
+fn main_1() {
+ var x_101_phi : bool;
+ let x_11 : bool = (true & true);
+ let x_12 : bool = !(x_11);
+ x_101_phi = x_11;
+ if (true) {
+ x_101_phi = x_12;
+ }
+ let x_101 : bool = x_101_phi;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm
new file mode 100644
index 0000000..309eaa8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm
@@ -0,0 +1,147 @@
+; Test: SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 127
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%29 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%36 = OpConstantNull %v2float
+%37 = OpConstantNull %v3float
+%38 = OpConstantNull %v4float
+%39 = OpConstantComposite %v2int %int_1 %int_2
+%40 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%41 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%42 = OpConstantComposite %v2uint %uint_1 %uint_2
+%43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%44 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%45 = OpConstantComposite %v2float %float_1 %float_2
+%46 = OpConstantComposite %v2float %float_2 %float_1
+%47 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%48 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%50 = OpTypeSampler
+%51 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%53 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%55 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%56 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%58 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%59 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%61 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%62 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%63 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%65 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%67 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%68 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%70 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%71 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%73 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%74 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%75 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%77 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%79 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%80 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%82 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%83 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%85 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%86 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%_ptr_UniformConstant_86 = OpTypePointer UniformConstant %86
+%10 = OpVariable %_ptr_UniformConstant_50 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_51 UniformConstant
+%1 = OpFunction %void None %3
+%126 = OpLabel
+%110 = OpCopyObject %_ptr_UniformConstant_50 %10
+%120 = OpCopyObject %_ptr_UniformConstant_51 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.hlsl
new file mode 100644
index 0000000..7792c6c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.spvasm
new file mode 100644
index 0000000..54fcf1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.wgsl
new file mode 100644
index 0000000..a747f05
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(0), binding(1)]] var x_20 : texture_1d<f32>;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm
new file mode 100644
index 0000000..b124eb3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm
@@ -0,0 +1,145 @@
+; Test: SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 125
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%29 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%36 = OpConstantNull %v2float
+%37 = OpConstantNull %v3float
+%38 = OpConstantNull %v4float
+%39 = OpConstantComposite %v2int %int_1 %int_2
+%40 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%41 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%42 = OpConstantComposite %v2uint %uint_1 %uint_2
+%43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%44 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%45 = OpConstantComposite %v2float %float_1 %float_2
+%46 = OpConstantComposite %v2float %float_2 %float_1
+%47 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%48 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%50 = OpTypeSampler
+%51 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%53 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%55 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%56 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%58 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%59 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%61 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%62 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%63 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%65 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%67 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%68 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%70 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%71 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%73 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%74 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%75 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%77 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%79 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%80 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%82 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%83 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%85 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%86 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%_ptr_UniformConstant_86 = OpTypePointer UniformConstant %86
+%10 = OpVariable %_ptr_UniformConstant_50 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_51 UniformConstant
+%1 = OpFunction %void None %3
+%124 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.hlsl
new file mode 100644
index 0000000..7792c6c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.spvasm
new file mode 100644
index 0000000..54fcf1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.wgsl
new file mode 100644
index 0000000..a747f05
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(0), binding(1)]] var x_20 : texture_1d<f32>;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm
new file mode 100644
index 0000000..caaea12
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm
@@ -0,0 +1,150 @@
+; Test: SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%29 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%36 = OpConstantNull %v2float
+%37 = OpConstantNull %v3float
+%38 = OpConstantNull %v4float
+%39 = OpConstantComposite %v2int %int_1 %int_2
+%40 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%41 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%42 = OpConstantComposite %v2uint %uint_1 %uint_2
+%43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%44 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%45 = OpConstantComposite %v2float %float_1 %float_2
+%46 = OpConstantComposite %v2float %float_2 %float_1
+%47 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%48 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%50 = OpTypeSampler
+%51 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%53 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%55 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%56 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%58 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%59 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%61 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%62 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%63 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%65 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%67 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%68 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%70 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%71 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%73 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%74 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%75 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%77 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%79 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%80 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%82 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%83 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%85 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%86 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%_ptr_UniformConstant_86 = OpTypePointer UniformConstant %86
+%125 = OpTypeSampledImage %51
+%10 = OpVariable %_ptr_UniformConstant_50 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_51 UniformConstant
+%1 = OpFunction %void None %3
+%126 = OpLabel
+%127 = OpLoad %50 %10
+%128 = OpLoad %51 %20
+%100 = OpSampledImage %125 %128 %127
+%200 = OpImage %51 %100
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.hlsl
new file mode 100644
index 0000000..7792c6c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.spvasm
new file mode 100644
index 0000000..54fcf1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.wgsl
new file mode 100644
index 0000000..a747f05
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(0), binding(1)]] var x_20 : texture_1d<f32>;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm
new file mode 100644
index 0000000..c456133
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm
@@ -0,0 +1,147 @@
+; Test: SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 127
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%29 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%36 = OpConstantNull %v2float
+%37 = OpConstantNull %v3float
+%38 = OpConstantNull %v4float
+%39 = OpConstantComposite %v2int %int_1 %int_2
+%40 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%41 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%42 = OpConstantComposite %v2uint %uint_1 %uint_2
+%43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%44 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%45 = OpConstantComposite %v2float %float_1 %float_2
+%46 = OpConstantComposite %v2float %float_2 %float_1
+%47 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%48 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%50 = OpTypeSampler
+%51 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%53 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%55 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%56 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%58 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%59 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%61 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%62 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%63 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%65 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%67 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%68 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%70 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%71 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%73 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%74 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%75 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%77 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%79 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%80 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%82 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%83 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%85 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%86 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%_ptr_UniformConstant_86 = OpTypePointer UniformConstant %86
+%10 = OpVariable %_ptr_UniformConstant_50 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_51 UniformConstant
+%1 = OpFunction %void None %3
+%126 = OpLabel
+%110 = OpLoad %50 %10
+%120 = OpLoad %51 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.hlsl
new file mode 100644
index 0000000..7792c6c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.spvasm
new file mode 100644
index 0000000..54fcf1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.wgsl
new file mode 100644
index 0000000..a747f05
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(0), binding(1)]] var x_20 : texture_1d<f32>;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm
new file mode 100644
index 0000000..b75ff6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm
@@ -0,0 +1,149 @@
+; Test: SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 129
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "main"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %10 DescriptorSet 0
+OpDecorate %10 Binding 0
+OpDecorate %20 DescriptorSet 0
+OpDecorate %20 Binding 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%int_0 = OpConstant %int 0
+%int_1 = OpConstant %int 1
+%int_2 = OpConstant %int 2
+%int_3 = OpConstant %int 3
+%int_4 = OpConstant %int 4
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_100 = OpConstant %uint 100
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%29 = OpConstantNull %float
+%float_0 = OpConstant %float 0
+%float_1 = OpConstant %float 1
+%float_2 = OpConstant %float 2
+%float_3 = OpConstant %float 3
+%float_4 = OpConstant %float 4
+%float_7 = OpConstant %float 7
+%36 = OpConstantNull %v2float
+%37 = OpConstantNull %v3float
+%38 = OpConstantNull %v4float
+%39 = OpConstantComposite %v2int %int_1 %int_2
+%40 = OpConstantComposite %v3int %int_1 %int_2 %int_3
+%41 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4
+%42 = OpConstantComposite %v2uint %uint_1 %uint_2
+%43 = OpConstantComposite %v3uint %uint_1 %uint_2 %uint_3
+%44 = OpConstantComposite %v4uint %uint_1 %uint_2 %uint_3 %uint_4
+%45 = OpConstantComposite %v2float %float_1 %float_2
+%46 = OpConstantComposite %v2float %float_2 %float_1
+%47 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+%48 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+%float_0_200000003 = OpConstant %float 0.200000003
+%50 = OpTypeSampler
+%51 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%52 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%53 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%54 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%55 = OpTypeImage %float 2D 0 1 1 1 Unknown
+%56 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%57 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%58 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%59 = OpTypeImage %float 1D 0 0 0 2 Rg32f
+%60 = OpTypeImage %float 2D 0 0 0 2 Rg32f
+%61 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%62 = OpTypeImage %float 3D 0 0 0 2 Rg32f
+%63 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%64 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%65 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%66 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%67 = OpTypeImage %uint 2D 0 1 1 1 Unknown
+%68 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%69 = OpTypeImage %uint Cube 0 0 0 1 Unknown
+%70 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%71 = OpTypeImage %uint 1D 0 0 0 2 Rg32ui
+%72 = OpTypeImage %uint 2D 0 0 0 2 Rg32ui
+%73 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%74 = OpTypeImage %uint 3D 0 0 0 2 Rg32ui
+%75 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%76 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%77 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%78 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%79 = OpTypeImage %int 2D 0 1 1 1 Unknown
+%80 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%81 = OpTypeImage %int Cube 0 0 0 1 Unknown
+%82 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%83 = OpTypeImage %int 1D 0 0 0 2 Rg32i
+%84 = OpTypeImage %int 2D 0 0 0 2 Rg32i
+%85 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%86 = OpTypeImage %int 3D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_50 = OpTypePointer UniformConstant %50
+%_ptr_UniformConstant_51 = OpTypePointer UniformConstant %51
+%_ptr_UniformConstant_52 = OpTypePointer UniformConstant %52
+%_ptr_UniformConstant_53 = OpTypePointer UniformConstant %53
+%_ptr_UniformConstant_54 = OpTypePointer UniformConstant %54
+%_ptr_UniformConstant_55 = OpTypePointer UniformConstant %55
+%_ptr_UniformConstant_56 = OpTypePointer UniformConstant %56
+%_ptr_UniformConstant_57 = OpTypePointer UniformConstant %57
+%_ptr_UniformConstant_58 = OpTypePointer UniformConstant %58
+%_ptr_UniformConstant_59 = OpTypePointer UniformConstant %59
+%_ptr_UniformConstant_60 = OpTypePointer UniformConstant %60
+%_ptr_UniformConstant_61 = OpTypePointer UniformConstant %61
+%_ptr_UniformConstant_62 = OpTypePointer UniformConstant %62
+%_ptr_UniformConstant_63 = OpTypePointer UniformConstant %63
+%_ptr_UniformConstant_64 = OpTypePointer UniformConstant %64
+%_ptr_UniformConstant_65 = OpTypePointer UniformConstant %65
+%_ptr_UniformConstant_66 = OpTypePointer UniformConstant %66
+%_ptr_UniformConstant_67 = OpTypePointer UniformConstant %67
+%_ptr_UniformConstant_68 = OpTypePointer UniformConstant %68
+%_ptr_UniformConstant_69 = OpTypePointer UniformConstant %69
+%_ptr_UniformConstant_70 = OpTypePointer UniformConstant %70
+%_ptr_UniformConstant_71 = OpTypePointer UniformConstant %71
+%_ptr_UniformConstant_72 = OpTypePointer UniformConstant %72
+%_ptr_UniformConstant_73 = OpTypePointer UniformConstant %73
+%_ptr_UniformConstant_74 = OpTypePointer UniformConstant %74
+%_ptr_UniformConstant_75 = OpTypePointer UniformConstant %75
+%_ptr_UniformConstant_76 = OpTypePointer UniformConstant %76
+%_ptr_UniformConstant_77 = OpTypePointer UniformConstant %77
+%_ptr_UniformConstant_78 = OpTypePointer UniformConstant %78
+%_ptr_UniformConstant_79 = OpTypePointer UniformConstant %79
+%_ptr_UniformConstant_80 = OpTypePointer UniformConstant %80
+%_ptr_UniformConstant_81 = OpTypePointer UniformConstant %81
+%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82
+%_ptr_UniformConstant_83 = OpTypePointer UniformConstant %83
+%_ptr_UniformConstant_84 = OpTypePointer UniformConstant %84
+%_ptr_UniformConstant_85 = OpTypePointer UniformConstant %85
+%_ptr_UniformConstant_86 = OpTypePointer UniformConstant %86
+%125 = OpTypeSampledImage %51
+%10 = OpVariable %_ptr_UniformConstant_50 UniformConstant
+%20 = OpVariable %_ptr_UniformConstant_51 UniformConstant
+%1 = OpFunction %void None %3
+%126 = OpLabel
+%127 = OpLoad %50 %10
+%128 = OpLoad %51 %20
+%100 = OpSampledImage %125 %128 %127
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.hlsl
new file mode 100644
index 0000000..7792c6c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+SamplerState x_10 : register(s0, space0);
+Texture1D<float4> x_20 : register(t1, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.spvasm
new file mode 100644
index 0000000..54fcf1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_10 "x_10"
+ OpName %x_20 "x_20"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %x_10 DescriptorSet 0
+ OpDecorate %x_10 Binding 0
+ OpDecorate %x_20 DescriptorSet 0
+ OpDecorate %x_20 Binding 1
+ %3 = OpTypeSampler
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_10 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %float = OpTypeFloat 32
+ %6 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
+ %x_20 = OpVariable %_ptr_UniformConstant_6 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.wgsl
new file mode 100644
index 0000000..a747f05
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+[[group(0), binding(0)]] var x_10 : sampler;
+
+[[group(0), binding(1)]] var x_20 : texture_1d<f32>;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm b/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm
new file mode 100644
index 0000000..d1da0ae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpCapability Sampled1D
+OpCapability Image1D
+OpCapability StorageImageExtendedFormats
+OpCapability ImageQuery
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var "var"
+OpDecorate %2 DescriptorSet 0
+OpDecorate %2 Binding 0
+OpDecorate %3 DescriptorSet 0
+OpDecorate %3 Binding 1
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%v2float = OpTypeVector %float 2
+%7 = OpConstantNull %v2float
+%8 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%9 = OpTypeSampledImage %8
+%10 = OpTypeSampler
+%_ptr_UniformConstant_8 = OpTypePointer UniformConstant %8
+%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10
+%2 = OpVariable %_ptr_UniformConstant_8 UniformConstant
+%3 = OpVariable %_ptr_UniformConstant_10 UniformConstant
+%void = OpTypeVoid
+%14 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%100 = OpFunction %void None %14
+%16 = OpLabel
+%var = OpVariable %_ptr_Function_v4float Function
+%17 = OpCopyObject %_ptr_UniformConstant_8 %2
+%18 = OpCopyObject %_ptr_UniformConstant_10 %3
+%19 = OpLoad %8 %17
+%20 = OpLoad %10 %18
+%21 = OpSampledImage %9 %19 %20
+%22 = OpImageSampleImplicitLod %v4float %21 %7
+%23 = OpLoad %8 %17
+%24 = OpLoad %10 %18
+%25 = OpSampledImage %9 %23 %24
+%26 = OpImageSampleImplicitLod %v4float %25 %7
+%27 = OpFAdd %v4float %22 %26
+OpStore %var %27
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.hlsl
new file mode 100644
index 0000000..7aadea3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.hlsl
@@ -0,0 +1,15 @@
+Texture2D<float4> x_2 : register(t0, space0);
+SamplerState x_3 : register(s1, space0);
+
+void main_1() {
+ float4 var_1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+ const float4 x_22 = x_2.Sample(x_3, float2(0.0f, 0.0f));
+ const float4 x_26 = x_2.Sample(x_3, float2(0.0f, 0.0f));
+ var_1 = (x_22 + x_26);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.msl
new file mode 100644
index 0000000..9ff54da
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float4 var_1 = 0.0f;
+ float4 const x_22 = tint_symbol_1.sample(tint_symbol_2, float2(0.0f, 0.0f));
+ float4 const x_26 = tint_symbol_1.sample(tint_symbol_2, float2(0.0f, 0.0f));
+ var_1 = (x_22 + x_26);
+ return;
+}
+
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_3 [[texture(0)]], sampler tint_symbol_4 [[sampler(1)]]) {
+ main_1(tint_symbol_3, tint_symbol_4);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.spvasm
new file mode 100644
index 0000000..bf2703b6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_2 "x_2"
+ OpName %x_3 "x_3"
+ OpName %main_1 "main_1"
+ OpName %var_1 "var_1"
+ OpName %main "main"
+ OpDecorate %x_2 DescriptorSet 0
+ OpDecorate %x_2 Binding 0
+ OpDecorate %x_3 DescriptorSet 0
+ OpDecorate %x_3 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %x_2 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %x_3 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %15 = OpConstantNull %v4float
+ %19 = OpTypeSampledImage %3
+ %v2float = OpTypeVector %float 2
+ %float_0 = OpConstant %float 0
+ %23 = OpConstantComposite %v2float %float_0 %float_0
+ %main_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %var_1 = OpVariable %_ptr_Function_v4float Function %15
+ %17 = OpLoad %7 %x_3
+ %18 = OpLoad %3 %x_2
+ %20 = OpSampledImage %19 %18 %17
+ %16 = OpImageSampleImplicitLod %v4float %20 %23
+ %25 = OpLoad %7 %x_3
+ %26 = OpLoad %3 %x_2
+ %27 = OpSampledImage %19 %26 %25
+ %24 = OpImageSampleImplicitLod %v4float %27 %23
+ %28 = OpFAdd %v4float %16 %24
+ OpStore %var_1 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %8
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.wgsl
new file mode 100644
index 0000000..57dd5c4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+[[group(0), binding(0)]] var x_2 : texture_2d<f32>;
+
+[[group(0), binding(1)]] var x_3 : sampler;
+
+fn main_1() {
+ var var_1 : vec4<f32>;
+ let x_22 : vec4<f32> = textureSample(x_2, x_3, vec2<f32>(0.0, 0.0));
+ let x_26 : vec4<f32> = textureSample(x_2, x_3, vec2<f32>(0.0, 0.0));
+ var_1 = (x_22 + x_26);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm
new file mode 100644
index 0000000..ce7f83a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm
@@ -0,0 +1,36 @@
+; Test: SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+OpMemberName %_struct_4 0 "first"
+OpMemberName %_struct_4 1 "rtarr"
+OpDecorate %_struct_4 Block
+OpMemberDecorate %_struct_4 0 Offset 0
+OpMemberDecorate %_struct_4 1 Offset 4
+OpDecorate %_runtimearr_uint ArrayStride 4
+OpDecorate %myvar DescriptorSet 0
+OpDecorate %myvar Binding 0
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+%_struct_4 = OpTypeStruct %uint %_runtimearr_uint
+%_ptr_StorageBuffer__struct_4 = OpTypePointer StorageBuffer %_struct_4
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%myvar = OpVariable %_ptr_StorageBuffer__struct_4 StorageBuffer
+%100 = OpFunction %void None %7
+%13 = OpLabel
+%2 = OpAccessChain %_ptr_StorageBuffer__struct_4 %myvar
+%1 = OpArrayLength %uint %2 1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..6909040
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+RWByteAddressBuffer myvar : register(u0, space0);
+
+void main_1() {
+ uint tint_symbol_1 = 0u;
+ myvar.GetDimensions(tint_symbol_1);
+ const uint tint_symbol_2 = ((tint_symbol_1 - 4u) / 4u);
+ const uint x_1 = tint_symbol_2;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..ceb3198
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_1 {
+ /* 0x0000 */ uint4 buffer_size[1];
+};
+struct S {
+ /* 0x0000 */ uint first;
+ /* 0x0004 */ uint rtarr[1];
+};
+
+void main_1(constant tint_symbol_1& tint_symbol_2) {
+ uint const x_1 = ((tint_symbol_2.buffer_size[0u][0u] - 4u) / 4u);
+ return;
+}
+
+fragment void tint_symbol(constant tint_symbol_1& tint_symbol_2 [[buffer(30)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..e397172
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "first"
+ OpMemberName %S 1 "rtarr"
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpDecorate %_runtimearr_uint ArrayStride 4
+ OpDecorate %myvar DescriptorSet 0
+ OpDecorate %myvar Binding 0
+ %uint = OpTypeInt 32 0
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+ %S = OpTypeStruct %uint %_runtimearr_uint
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %myvar = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %6
+ %9 = OpLabel
+ %10 = OpArrayLength %uint %myvar 1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %6
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..159e6ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+type RTArr = [[stride(4)]] array<u32>;
+
+[[block]]
+struct S {
+ first : u32;
+ rtarr : RTArr;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+
+fn main_1() {
+ let x_1 : u32 = arrayLength(&(myvar.rtarr));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm
new file mode 100644
index 0000000..1f5160d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm
@@ -0,0 +1,35 @@
+; Test: SpvParserMemoryTest_ArrayLength_FromVar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+OpMemberName %_struct_3 0 "first"
+OpMemberName %_struct_3 1 "rtarr"
+OpDecorate %_struct_3 Block
+OpMemberDecorate %_struct_3 0 Offset 0
+OpMemberDecorate %_struct_3 1 Offset 4
+OpDecorate %_runtimearr_uint ArrayStride 4
+OpDecorate %myvar DescriptorSet 0
+OpDecorate %myvar Binding 0
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+%_struct_3 = OpTypeStruct %uint %_runtimearr_uint
+%_ptr_StorageBuffer__struct_3 = OpTypePointer StorageBuffer %_struct_3
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%myvar = OpVariable %_ptr_StorageBuffer__struct_3 StorageBuffer
+%100 = OpFunction %void None %6
+%12 = OpLabel
+%1 = OpArrayLength %uint %myvar 1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.hlsl
new file mode 100644
index 0000000..6909040
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+RWByteAddressBuffer myvar : register(u0, space0);
+
+void main_1() {
+ uint tint_symbol_1 = 0u;
+ myvar.GetDimensions(tint_symbol_1);
+ const uint tint_symbol_2 = ((tint_symbol_1 - 4u) / 4u);
+ const uint x_1 = tint_symbol_2;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.msl
new file mode 100644
index 0000000..ceb3198
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_1 {
+ /* 0x0000 */ uint4 buffer_size[1];
+};
+struct S {
+ /* 0x0000 */ uint first;
+ /* 0x0004 */ uint rtarr[1];
+};
+
+void main_1(constant tint_symbol_1& tint_symbol_2) {
+ uint const x_1 = ((tint_symbol_2.buffer_size[0u][0u] - 4u) / 4u);
+ return;
+}
+
+fragment void tint_symbol(constant tint_symbol_1& tint_symbol_2 [[buffer(30)]]) {
+ main_1(tint_symbol_2);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.spvasm
new file mode 100644
index 0000000..e397172
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "first"
+ OpMemberName %S 1 "rtarr"
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpDecorate %_runtimearr_uint ArrayStride 4
+ OpDecorate %myvar DescriptorSet 0
+ OpDecorate %myvar Binding 0
+ %uint = OpTypeInt 32 0
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+ %S = OpTypeStruct %uint %_runtimearr_uint
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %myvar = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %6
+ %9 = OpLabel
+ %10 = OpArrayLength %uint %myvar 1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %6
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.wgsl
new file mode 100644
index 0000000..159e6ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+type RTArr = [[stride(4)]] array<u32>;
+
+[[block]]
+struct S {
+ first : u32;
+ rtarr : RTArr;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+
+fn main_1() {
+ let x_1 : u32 = arrayLength(&(myvar.rtarr));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm
new file mode 100644
index 0000000..101cfc9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm
@@ -0,0 +1,30 @@
+; Test: SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%mat3v4float = OpTypeMatrix %v4float 3
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
+%uint = OpTypeInt 32 0
+%uint_2 = OpConstant %uint 2
+%float_42 = OpConstant %float 42
+%13 = OpConstantComposite %v4float %float_42 %float_42 %float_42 %float_42
+%myvar = OpVariable %_ptr_Private_mat3v4float Private
+%100 = OpFunction %void None %4
+%14 = OpLabel
+%2 = OpAccessChain %_ptr_Private_v4float %myvar %uint_2
+OpStore %2 %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.hlsl
new file mode 100644
index 0000000..a823f8a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+static float3x4 myvar = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ myvar[2u] = float4(42.0f, 42.0f, 42.0f, 42.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.msl
new file mode 100644
index 0000000..691c9bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread float3x4* const tint_symbol_1) {
+ (*(tint_symbol_1))[2u] = float4(42.0f, 42.0f, 42.0f, 42.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ thread float3x4 tint_symbol_2 = float3x4(0.0f);
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.spvasm
new file mode 100644
index 0000000..d3c1087
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%mat3v4float = OpTypeMatrix %v4float 3
+%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
+ %6 = OpConstantNull %mat3v4float
+ %myvar = OpVariable %_ptr_Private_mat3v4float Private %6
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %float_42 = OpConstant %float 42
+ %16 = OpConstantComposite %v4float %float_42 %float_42 %float_42 %float_42
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_Private_v4float %myvar %uint_2
+ OpStore %14 %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.wgsl
new file mode 100644
index 0000000..5946ed3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+var<private> myvar : mat3x4<f32>;
+
+fn main_1() {
+ myvar[2u] = vec4<f32>(42.0, 42.0, 42.0, 42.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm
new file mode 100644
index 0000000..76d2b9b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm
@@ -0,0 +1,30 @@
+; Test: SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%mat3v4float = OpTypeMatrix %v4float 3
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
+%uint = OpTypeInt 32 0
+%uint_2 = OpConstant %uint 2
+%uint_3 = OpConstant %uint 3
+%float_42 = OpConstant %float 42
+%myvar = OpVariable %_ptr_Private_mat3v4float Private
+%100 = OpFunction %void None %4
+%14 = OpLabel
+%2 = OpAccessChain %_ptr_Private_float %myvar %uint_2 %uint_3
+OpStore %2 %float_42
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..075acd5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+static float3x4 myvar = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ myvar[2u].w = 42.0f;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..70ad8df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread float3x4* const tint_symbol_1) {
+ (*(tint_symbol_1))[2u].w = 42.0f;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread float3x4 tint_symbol_2 = float3x4(0.0f);
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..87f8e08
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%mat3v4float = OpTypeMatrix %v4float 3
+%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
+ %6 = OpConstantNull %mat3v4float
+ %myvar = OpVariable %_ptr_Private_mat3v4float Private %6
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+ %uint_3 = OpConstant %uint 3
+%_ptr_Private_float = OpTypePointer Private %float
+ %float_42 = OpConstant %float 42
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ %15 = OpAccessChain %_ptr_Private_float %myvar %uint_2 %uint_3
+ OpStore %15 %float_42
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..b299269
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+var<private> myvar : mat3x4<f32>;
+
+fn main_1() {
+ myvar[2u].w = 42.0;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm
new file mode 100644
index 0000000..e19550f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm
@@ -0,0 +1,30 @@
+; Test: SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%v2uint = OpTypeVector %uint 2
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_v2uint = OpTypePointer Private %v2uint
+%10 = OpTypeFunction %void %_ptr_Private_v2uint
+%uint_0 = OpConstant %uint 0
+%200 = OpFunction %void None %10
+%1 = OpFunctionParameter %_ptr_Private_v2uint
+%12 = OpLabel
+%2 = OpAccessChain %_ptr_Private_uint %1 %uint_0
+%3 = OpLoad %uint %2
+OpReturn
+OpFunctionEnd
+%100 = OpFunction %void None %5
+%13 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.hlsl
new file mode 100644
index 0000000..724afae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+void x_200(inout uint2 x_1) {
+ const uint x_3 = x_1.x;
+ return;
+}
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.msl
new file mode 100644
index 0000000..3cbe56b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_200(thread uint2* const x_1) {
+ uint const x_3 = (*(x_1)).x;
+ return;
+}
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.spvasm
new file mode 100644
index 0000000..d350ad9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+%_ptr_Private_v2uint = OpTypePointer Private %v2uint
+ %1 = OpTypeFunction %void %_ptr_Private_v2uint
+ %uint_0 = OpConstant %uint 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %14 = OpTypeFunction %void
+ %x_200 = OpFunction %void None %1
+ %x_1 = OpFunctionParameter %_ptr_Private_v2uint
+ %8 = OpLabel
+ %12 = OpAccessChain %_ptr_Private_uint %x_1 %uint_0
+ %13 = OpLoad %uint %12
+ OpReturn
+ OpFunctionEnd
+ %main_1 = OpFunction %void None %14
+ %16 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %14
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.wgsl
new file mode 100644
index 0000000..1aa32ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn x_200(x_1 : ptr<private, vec2<u32>>) {
+ let x_3 : u32 = (*(x_1)).x;
+ return;
+}
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm
new file mode 100644
index 0000000..84d9ab4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 9
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %3 "main"
+OpExecutionMode %3 OriginUpperLeft
+%uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%3 = OpFunction %void None %7
+%8 = OpLabel
+%1 = OpVariable %_ptr_Function_uint Function
+%2 = OpAccessChain %_ptr_Function_uint %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.hlsl
new file mode 100644
index 0000000..2706802
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ uint x_1 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.msl
new file mode 100644
index 0000000..223e020
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint x_1 = 0u;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.spvasm
new file mode 100644
index 0000000..f910efa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_1 "x_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %8 = OpConstantNull %uint
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_1 = OpVariable %_ptr_Function_uint Function %8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.wgsl
new file mode 100644
index 0000000..88fb923
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ var x_1 : u32;
+ let x_2 : ptr<function, u32> = &(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm
new file mode 100644
index 0000000..2b301c6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm
@@ -0,0 +1,30 @@
+; Test: SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%mat3v4float = OpTypeMatrix %v4float 3
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
+%uint = OpTypeInt 32 0
+%uint_2 = OpConstant %uint 2
+%float_42 = OpConstant %float 42
+%13 = OpConstantComposite %v4float %float_42 %float_42 %float_42 %float_42
+%myvar = OpVariable %_ptr_Private_mat3v4float Private
+%100 = OpFunction %void None %4
+%14 = OpLabel
+%2 = OpAccessChain %_ptr_Private_v4float %myvar %uint_2
+OpStore %2 %13
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.hlsl
new file mode 100644
index 0000000..a823f8a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+static float3x4 myvar = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ myvar[2u] = float4(42.0f, 42.0f, 42.0f, 42.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.msl
new file mode 100644
index 0000000..691c9bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread float3x4* const tint_symbol_1) {
+ (*(tint_symbol_1))[2u] = float4(42.0f, 42.0f, 42.0f, 42.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ thread float3x4 tint_symbol_2 = float3x4(0.0f);
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.spvasm
new file mode 100644
index 0000000..d3c1087
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%mat3v4float = OpTypeMatrix %v4float 3
+%_ptr_Private_mat3v4float = OpTypePointer Private %mat3v4float
+ %6 = OpConstantNull %mat3v4float
+ %myvar = OpVariable %_ptr_Private_mat3v4float Private %6
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %float_42 = OpConstant %float 42
+ %16 = OpConstantComposite %v4float %float_42 %float_42 %float_42 %float_42
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ %14 = OpAccessChain %_ptr_Private_v4float %myvar %uint_2
+ OpStore %14 %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.wgsl
new file mode 100644
index 0000000..5946ed3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+var<private> myvar : mat3x4<f32>;
+
+fn main_1() {
+ myvar[2u] = vec4<f32>(42.0, 42.0, 42.0, 42.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm
new file mode 100644
index 0000000..212defd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+OpMemberName %_struct_3 1 "age"
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%float_42 = OpConstant %float 42
+%_struct_3 = OpTypeStruct %float %float
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private__struct_3 = OpTypePointer Private %_struct_3
+%uint = OpTypeInt 32 0
+%uint_1 = OpConstant %uint 1
+%myvar = OpVariable %_ptr_Private__struct_3 Private
+%100 = OpFunction %void None %5
+%12 = OpLabel
+%2 = OpAccessChain %_ptr_Private_float %myvar %uint_1
+OpStore %2 %float_42
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.hlsl
new file mode 100644
index 0000000..3a71de3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+struct S {
+ float field0;
+ float age;
+};
+
+static S myvar = (S)0;
+
+void main_1() {
+ myvar.age = 42.0f;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.msl
new file mode 100644
index 0000000..30fb4de
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float field0;
+ float age;
+};
+
+void main_1(thread S* const tint_symbol_1) {
+ (*(tint_symbol_1)).age = 42.0f;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread S tint_symbol_2 = {};
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.spvasm
new file mode 100644
index 0000000..a8679b9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.spvasm
@@ -0,0 +1,39 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "age"
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ %float = OpTypeFloat 32
+ %S = OpTypeStruct %float %float
+%_ptr_Private_S = OpTypePointer Private %S
+ %5 = OpConstantNull %S
+ %myvar = OpVariable %_ptr_Private_S Private %5
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Private_float = OpTypePointer Private %float
+ %float_42 = OpConstant %float 42
+ %main_1 = OpFunction %void None %6
+ %9 = OpLabel
+ %13 = OpAccessChain %_ptr_Private_float %myvar %uint_1
+ OpStore %13 %float_42
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %6
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.wgsl
new file mode 100644
index 0000000..1020d48
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+struct S {
+ field0 : f32;
+ age : f32;
+};
+
+var<private> myvar : S;
+
+fn main_1() {
+ myvar.age = 42.0;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm
new file mode 100644
index 0000000..fc17538
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm
@@ -0,0 +1,37 @@
+; Test: SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+OpName %myvar2 "myvar2"
+OpMemberName %_struct_3 1 "age"
+OpMemberName %_struct_4 1 "ancientness"
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%float_42 = OpConstant %float 42
+%float_420 = OpConstant %float 420
+%_struct_3 = OpTypeStruct %float %float
+%_struct_4 = OpTypeStruct %float %float
+%_ptr_Private_float = OpTypePointer Private %float
+%_ptr_Private__struct_3 = OpTypePointer Private %_struct_3
+%_ptr_Private__struct_4 = OpTypePointer Private %_struct_4
+%uint = OpTypeInt 32 0
+%uint_1 = OpConstant %uint 1
+%myvar = OpVariable %_ptr_Private__struct_3 Private
+%myvar2 = OpVariable %_ptr_Private__struct_4 Private
+%100 = OpFunction %void None %6
+%16 = OpLabel
+%2 = OpAccessChain %_ptr_Private_float %myvar %uint_1
+OpStore %2 %float_42
+%20 = OpAccessChain %_ptr_Private_float %myvar2 %uint_1
+OpStore %20 %float_420
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.hlsl
new file mode 100644
index 0000000..a54dfa0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.hlsl
@@ -0,0 +1,22 @@
+struct S {
+ float field0;
+ float age;
+};
+struct S_1 {
+ float field0;
+ float ancientness;
+};
+
+static S myvar = (S)0;
+static S_1 myvar2 = (S_1)0;
+
+void main_1() {
+ myvar.age = 42.0f;
+ myvar2.ancientness = 420.0f;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.msl
new file mode 100644
index 0000000..7321f9b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float field0;
+ float age;
+};
+struct S_1 {
+ float field0;
+ float ancientness;
+};
+
+void main_1(thread S* const tint_symbol_1, thread S_1* const tint_symbol_2) {
+ (*(tint_symbol_1)).age = 42.0f;
+ (*(tint_symbol_2)).ancientness = 420.0f;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread S tint_symbol_3 = {};
+ thread S_1 tint_symbol_4 = {};
+ main_1(&(tint_symbol_3), &(tint_symbol_4));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.spvasm
new file mode 100644
index 0000000..8ba7712
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.spvasm
@@ -0,0 +1,52 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "age"
+ OpName %myvar "myvar"
+ OpName %S_1 "S_1"
+ OpMemberName %S_1 0 "field0"
+ OpMemberName %S_1 1 "ancientness"
+ OpName %myvar2 "myvar2"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S_1 0 Offset 0
+ OpMemberDecorate %S_1 1 Offset 4
+ %float = OpTypeFloat 32
+ %S = OpTypeStruct %float %float
+%_ptr_Private_S = OpTypePointer Private %S
+ %5 = OpConstantNull %S
+ %myvar = OpVariable %_ptr_Private_S Private %5
+ %S_1 = OpTypeStruct %float %float
+%_ptr_Private_S_1 = OpTypePointer Private %S_1
+ %9 = OpConstantNull %S_1
+ %myvar2 = OpVariable %_ptr_Private_S_1 Private %9
+ %void = OpTypeVoid
+ %10 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Private_float = OpTypePointer Private %float
+ %float_42 = OpConstant %float 42
+ %float_420 = OpConstant %float 420
+ %main_1 = OpFunction %void None %10
+ %13 = OpLabel
+ %17 = OpAccessChain %_ptr_Private_float %myvar %uint_1
+ OpStore %17 %float_42
+ %19 = OpAccessChain %_ptr_Private_float %myvar2 %uint_1
+ OpStore %19 %float_420
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %10
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.wgsl
new file mode 100644
index 0000000..6a3bcf1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+struct S {
+ field0 : f32;
+ age : f32;
+};
+
+struct S_1 {
+ field0 : f32;
+ ancientness : f32;
+};
+
+var<private> myvar : S;
+
+var<private> myvar2 : S_1;
+
+fn main_1() {
+ myvar.age = 42.0;
+ myvar2.ancientness = 420.0;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm
new file mode 100644
index 0000000..7cbc9d6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm
@@ -0,0 +1,37 @@
+; Test: SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+OpMemberName %_struct_3 1 "age"
+OpDecorate %myvar DescriptorSet 0
+OpDecorate %myvar Binding 0
+OpDecorate %_struct_3 BufferBlock
+OpMemberDecorate %_struct_3 0 Offset 0
+OpMemberDecorate %_struct_3 1 Offset 4
+OpDecorate %_runtimearr_float ArrayStride 4
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%float_42 = OpConstant %float 42
+%_runtimearr_float = OpTypeRuntimeArray %float
+%_struct_3 = OpTypeStruct %float %_runtimearr_float
+%_ptr_Uniform_float = OpTypePointer Uniform %float
+%_ptr_Uniform__struct_3 = OpTypePointer Uniform %_struct_3
+%uint = OpTypeInt 32 0
+%uint_1 = OpConstant %uint 1
+%uint_2 = OpConstant %uint 2
+%myvar = OpVariable %_ptr_Uniform__struct_3 Uniform
+%100 = OpFunction %void None %6
+%14 = OpLabel
+%2 = OpAccessChain %_ptr_Uniform_float %myvar %uint_1 %uint_2
+OpStore %2 %float_42
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.hlsl
new file mode 100644
index 0000000..0111825
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+RWByteAddressBuffer myvar : register(u0, space0);
+
+void main_1() {
+ myvar.Store(12u, asuint(42.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.msl
new file mode 100644
index 0000000..02d7554
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ /* 0x0000 */ float field0;
+ /* 0x0004 */ float age[1];
+};
+
+void main_1(device S& myvar) {
+ myvar.age[2u] = 42.0f;
+ return;
+}
+
+fragment void tint_symbol(device S& myvar [[buffer(0)]]) {
+ main_1(myvar);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.spvasm
new file mode 100644
index 0000000..424eb40
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "age"
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpDecorate %_runtimearr_float ArrayStride 4
+ OpDecorate %myvar DescriptorSet 0
+ OpDecorate %myvar Binding 0
+ %float = OpTypeFloat 32
+%_runtimearr_float = OpTypeRuntimeArray %float
+ %S = OpTypeStruct %float %_runtimearr_float
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %myvar = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+ %float_42 = OpConstant %float 42
+ %main_1 = OpFunction %void None %6
+ %9 = OpLabel
+ %14 = OpAccessChain %_ptr_StorageBuffer_float %myvar %uint_1 %uint_2
+ OpStore %14 %float_42
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %6
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.wgsl
new file mode 100644
index 0000000..1613181
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+type RTArr = [[stride(4)]] array<f32>;
+
+[[block]]
+struct S {
+ field0 : f32;
+ age : RTArr;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+
+fn main_1() {
+ myvar.age[2u] = 42.0;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm
new file mode 100644
index 0000000..9f3ee67
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm
@@ -0,0 +1,32 @@
+; Test: SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+OpName %a_dynamic_index "a_dynamic_index"
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%v4uint = OpTypeVector %uint 4
+%uint_2 = OpConstant %uint 2
+%uint_42 = OpConstant %uint 42
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_v4uint = OpTypePointer Private %v4uint
+%myvar = OpVariable %_ptr_Private_v4uint Private
+%10 = OpVariable %_ptr_Private_v4uint Private
+%100 = OpFunction %void None %4
+%15 = OpLabel
+%11 = OpLoad %v4uint %10
+%12 = OpCompositeExtract %uint %11 2
+%a_dynamic_index = OpCopyObject %uint %12
+%2 = OpAccessChain %_ptr_Private_uint %myvar %a_dynamic_index
+OpStore %2 %uint_42
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.hlsl
new file mode 100644
index 0000000..0bb697a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+void set_uint4(inout uint4 vec, int idx, uint val) {
+ vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
+}
+
+static uint4 myvar = uint4(0u, 0u, 0u, 0u);
+static uint4 x_10 = uint4(0u, 0u, 0u, 0u);
+
+void main_1() {
+ const uint a_dynamic_index = x_10.z;
+ set_uint4(myvar, a_dynamic_index, 42u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.msl
new file mode 100644
index 0000000..fb8ba9e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint4* const tint_symbol_1, thread uint4* const tint_symbol_2) {
+ uint4 const x_11 = *(tint_symbol_1);
+ uint const a_dynamic_index = x_11.z;
+ (*(tint_symbol_2))[a_dynamic_index] = 42u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint4 tint_symbol_3 = 0u;
+ thread uint4 tint_symbol_4 = 0u;
+ main_1(&(tint_symbol_3), &(tint_symbol_4));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.spvasm
new file mode 100644
index 0000000..403d538
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %myvar "myvar"
+ OpName %x_10 "x_10"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Private_v4uint = OpTypePointer Private %v4uint
+ %5 = OpConstantNull %v4uint
+ %myvar = OpVariable %_ptr_Private_v4uint Private %5
+ %x_10 = OpVariable %_ptr_Private_v4uint Private %5
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %7
+ %10 = OpLabel
+ %11 = OpLoad %v4uint %x_10
+ %12 = OpCompositeExtract %uint %11 2
+ %14 = OpAccessChain %_ptr_Private_uint %myvar %12
+ OpStore %14 %uint_42
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %7
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.wgsl
new file mode 100644
index 0000000..9b3b236
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+var<private> myvar : vec4<u32>;
+
+var<private> x_10 : vec4<u32>;
+
+fn main_1() {
+ let x_11 : vec4<u32> = x_10;
+ let a_dynamic_index : u32 = x_11.z;
+ myvar[a_dynamic_index] = 42u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm
new file mode 100644
index 0000000..fc28088
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm
@@ -0,0 +1,27 @@
+; Test: SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%v4uint = OpTypeVector %uint 4
+%uint_2 = OpConstant %uint 2
+%uint_42 = OpConstant %uint 42
+%_ptr_Private_uint = OpTypePointer Private %uint
+%_ptr_Private_v4uint = OpTypePointer Private %v4uint
+%myvar = OpVariable %_ptr_Private_v4uint Private
+%100 = OpFunction %void None %4
+%11 = OpLabel
+%2 = OpAccessChain %_ptr_Private_uint %myvar %uint_2
+OpStore %2 %uint_42
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.hlsl
new file mode 100644
index 0000000..04495ad
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+static uint4 myvar = uint4(0u, 0u, 0u, 0u);
+
+void main_1() {
+ myvar.z = 42u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.msl
new file mode 100644
index 0000000..a724359
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint4* const tint_symbol_1) {
+ (*(tint_symbol_1)).z = 42u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint4 tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.spvasm
new file mode 100644
index 0000000..16433fc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Private_v4uint = OpTypePointer Private %v4uint
+ %5 = OpConstantNull %v4uint
+ %myvar = OpVariable %_ptr_Private_v4uint Private %5
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_2 = OpConstant %uint 2
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %6
+ %9 = OpLabel
+ %12 = OpAccessChain %_ptr_Private_uint %myvar %uint_2
+ OpStore %12 %uint_42
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %6
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.wgsl
new file mode 100644
index 0000000..e52b291
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+var<private> myvar : vec4<u32>;
+
+fn main_1() {
+ myvar.z = 42u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm
new file mode 100644
index 0000000..a1b1477
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm
@@ -0,0 +1,24 @@
+; Test: SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%uint_42 = OpConstant %uint 42
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Private_uint = OpTypePointer Private %uint
+%2 = OpVariable %_ptr_Private_uint Private
+%100 = OpFunction %void None %4
+%9 = OpLabel
+%1 = OpVariable %_ptr_Function_uint Function
+OpCopyMemory %2 %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.hlsl
new file mode 100644
index 0000000..79794e4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+static uint x_2 = 0u;
+
+void main_1() {
+ uint x_1 = 0u;
+ x_2 = x_1;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.msl
new file mode 100644
index 0000000..d71a2b9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ uint x_1 = 0u;
+ *(tint_symbol_1) = x_1;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.spvasm
new file mode 100644
index 0000000..ce6e08a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_2 "x_2"
+ OpName %main_1 "main_1"
+ OpName %x_1 "x_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_2 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ %x_1 = OpVariable %_ptr_Function_uint Function %4
+ %11 = OpLoad %uint %x_1
+ OpStore %x_2 %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.wgsl
new file mode 100644
index 0000000..c4daeea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+var<private> x_2 : u32;
+
+fn main_1() {
+ var x_1 : u32;
+ x_2 = x_1;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm
new file mode 100644
index 0000000..e5ba4a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm
@@ -0,0 +1,24 @@
+; Test: SpvParserMemoryTest_EmitStatement_LoadBool.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%8 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+%100 = OpFunction %void None %4
+%10 = OpLabel
+%1 = OpVariable %_ptr_Function_bool Function %true
+%2 = OpLoad %bool %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.hlsl
new file mode 100644
index 0000000..82ac527
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ bool x_1 = true;
+ const bool x_2 = x_1;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.msl
new file mode 100644
index 0000000..09bfe9f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool x_1 = true;
+ bool const x_2 = x_1;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.spvasm
new file mode 100644
index 0000000..4b20fc2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_1 "x_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %9 = OpConstantNull %bool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_1 = OpVariable %_ptr_Function_bool Function %9
+ OpStore %x_1 %true
+ %10 = OpLoad %bool %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.wgsl
new file mode 100644
index 0000000..98e051f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ var x_1 : bool = true;
+ let x_2 : bool = x_1;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm
new file mode 100644
index 0000000..a681bf5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm
@@ -0,0 +1,23 @@
+; Test: SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%uint_42 = OpConstant %uint 42
+%_ptr_Function_uint = OpTypePointer Function %uint
+%100 = OpFunction %void None %5
+%9 = OpLabel
+%1 = OpVariable %_ptr_Function_uint Function %uint_42
+%2 = OpLoad %uint %1
+%3 = OpLoad %uint %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..99af8f9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ uint x_1 = 42u;
+ const uint x_2 = x_1;
+ const uint x_3 = x_1;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.msl
new file mode 100644
index 0000000..0bebad7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint x_1 = 42u;
+ uint const x_2 = x_1;
+ uint const x_3 = x_1;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..ffd75f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_1 "x_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_42 = OpConstant %uint 42
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %9 = OpConstantNull %uint
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_1 = OpVariable %_ptr_Function_uint Function %9
+ OpStore %x_1 %uint_42
+ %10 = OpLoad %uint %x_1
+ %11 = OpLoad %uint %x_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..e83f8cd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+fn main_1() {
+ var x_1 : u32 = 42u;
+ let x_2 : u32 = x_1;
+ let x_3 : u32 = x_1;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm
new file mode 100644
index 0000000..2fb0b8b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm
@@ -0,0 +1,26 @@
+; Test: SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%7 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+%100 = OpFunction %void None %3
+%9 = OpLabel
+%1 = OpVariable %_ptr_Function_bool Function
+OpStore %1 %true
+OpStore %1 %false
+OpStore %1 %7
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.hlsl
new file mode 100644
index 0000000..4c3376e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void main_1() {
+ bool x_1 = false;
+ x_1 = true;
+ x_1 = false;
+ x_1 = false;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.msl
new file mode 100644
index 0000000..b4282dd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool x_1 = false;
+ x_1 = true;
+ x_1 = false;
+ x_1 = false;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.spvasm
new file mode 100644
index 0000000..ae01291
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_1 "x_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %8 = OpConstantNull %bool
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_1 = OpVariable %_ptr_Function_bool Function %8
+ OpStore %x_1 %true
+ OpStore %x_1 %false
+ OpStore %x_1 %false
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.wgsl
new file mode 100644
index 0000000..bcc6cb9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+fn main_1() {
+ var x_1 : bool;
+ x_1 = true;
+ x_1 = false;
+ x_1 = false;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm
new file mode 100644
index 0000000..51361a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm
@@ -0,0 +1,24 @@
+; Test: SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%float_42 = OpConstant %float 42
+%6 = OpConstantNull %float
+%_ptr_Function_float = OpTypePointer Function %float
+%100 = OpFunction %void None %3
+%8 = OpLabel
+%1 = OpVariable %_ptr_Function_float Function
+OpStore %1 %float_42
+OpStore %1 %6
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.hlsl
new file mode 100644
index 0000000..0e9290e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ float x_1 = 0.0f;
+ x_1 = 42.0f;
+ x_1 = 0.0f;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.msl
new file mode 100644
index 0000000..c1d4c1f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float x_1 = 0.0f;
+ x_1 = 42.0f;
+ x_1 = 0.0f;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.spvasm
new file mode 100644
index 0000000..ca4e7a5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_1 "x_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+%_ptr_Function_float = OpTypePointer Function %float
+ %8 = OpConstantNull %float
+ %float_42 = OpConstant %float 42
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_1 = OpVariable %_ptr_Function_float Function %8
+ OpStore %x_1 %float_42
+ OpStore %x_1 %float_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.wgsl
new file mode 100644
index 0000000..51a00a5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+fn main_1() {
+ var x_1 : f32;
+ x_1 = 42.0;
+ x_1 = 0.0;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm
new file mode 100644
index 0000000..fe94908
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm
@@ -0,0 +1,24 @@
+; Test: SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%int = OpTypeInt 32 1
+%int_42 = OpConstant %int 42
+%6 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+%100 = OpFunction %void None %3
+%8 = OpLabel
+%1 = OpVariable %_ptr_Function_int Function
+OpStore %1 %int_42
+OpStore %1 %6
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.hlsl
new file mode 100644
index 0000000..1ecf6df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ int x_1 = 0;
+ x_1 = 42;
+ x_1 = 0;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.msl
new file mode 100644
index 0000000..bfcf069
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int x_1 = 0;
+ x_1 = 42;
+ x_1 = 0;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.spvasm
new file mode 100644
index 0000000..ceb82a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_1 "x_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %8 = OpConstantNull %int
+ %int_42 = OpConstant %int 42
+ %int_0 = OpConstant %int 0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_1 = OpVariable %_ptr_Function_int Function %8
+ OpStore %x_1 %int_42
+ OpStore %x_1 %int_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.wgsl
new file mode 100644
index 0000000..7fa89f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+fn main_1() {
+ var x_1 : i32;
+ x_1 = 42;
+ x_1 = 0;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm
new file mode 100644
index 0000000..8854013
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm
@@ -0,0 +1,22 @@
+; Test: SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%uint_42 = OpConstant %uint 42
+%_ptr_Private_uint = OpTypePointer Private %uint
+%1 = OpVariable %_ptr_Private_uint Private
+%100 = OpFunction %void None %3
+%7 = OpLabel
+OpStore %1 %uint_42
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.hlsl
new file mode 100644
index 0000000..ce9f2c6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+static uint x_1 = 0u;
+
+void main_1() {
+ x_1 = 42u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.msl
new file mode 100644
index 0000000..a117075
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1(thread uint* const tint_symbol_1) {
+ *(tint_symbol_1) = 42u;
+ return;
+}
+
+fragment void tint_symbol() {
+ thread uint tint_symbol_2 = 0u;
+ main_1(&(tint_symbol_2));
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.spvasm
new file mode 100644
index 0000000..5bfc4f8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %x_1 "x_1"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %uint = OpTypeInt 32 0
+%_ptr_Private_uint = OpTypePointer Private %uint
+ %4 = OpConstantNull %uint
+ %x_1 = OpVariable %_ptr_Private_uint Private %4
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpStore %x_1 %uint_42
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %5
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.wgsl
new file mode 100644
index 0000000..adfb154
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+var<private> x_1 : u32;
+
+fn main_1() {
+ x_1 = 42u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm
new file mode 100644
index 0000000..3ccb303
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm
@@ -0,0 +1,24 @@
+; Test: SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%uint_42 = OpConstant %uint 42
+%6 = OpConstantNull %uint
+%_ptr_Function_uint = OpTypePointer Function %uint
+%100 = OpFunction %void None %3
+%8 = OpLabel
+%1 = OpVariable %_ptr_Function_uint Function
+OpStore %1 %uint_42
+OpStore %1 %6
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.hlsl
new file mode 100644
index 0000000..a481728
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ uint x_1 = 0u;
+ x_1 = 42u;
+ x_1 = 0u;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.msl
new file mode 100644
index 0000000..2d18ec6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint x_1 = 0u;
+ x_1 = 42u;
+ x_1 = 0u;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.spvasm
new file mode 100644
index 0000000..f359441
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_1 "x_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %8 = OpConstantNull %uint
+ %uint_42 = OpConstant %uint 42
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_1 = OpVariable %_ptr_Function_uint Function %8
+ OpStore %x_1 %uint_42
+ OpStore %x_1 %uint_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.wgsl
new file mode 100644
index 0000000..0e7cc16
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+fn main_1() {
+ var x_1 : u32;
+ x_1 = 42u;
+ x_1 = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm
new file mode 100644
index 0000000..ac52ab0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm
@@ -0,0 +1,24 @@
+; Test: SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%uint_42 = OpConstant %uint 42
+%_ptr_Function_uint = OpTypePointer Function %uint
+%100 = OpFunction %void None %4
+%8 = OpLabel
+%1 = OpVariable %_ptr_Function_uint Function %uint_42
+%2 = OpLoad %uint %1
+OpStore %1 %2
+OpStore %1 %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.hlsl
new file mode 100644
index 0000000..50151bc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void main_1() {
+ uint x_1 = 42u;
+ const uint x_2 = x_1;
+ x_1 = x_2;
+ x_1 = x_2;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.msl
new file mode 100644
index 0000000..9d0f241
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint x_1 = 42u;
+ uint const x_2 = x_1;
+ x_1 = x_2;
+ x_1 = x_2;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.spvasm
new file mode 100644
index 0000000..742992c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_1 "x_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_42 = OpConstant %uint 42
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %9 = OpConstantNull %uint
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_1 = OpVariable %_ptr_Function_uint Function %9
+ OpStore %x_1 %uint_42
+ %10 = OpLoad %uint %x_1
+ OpStore %x_1 %10
+ OpStore %x_1 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.wgsl
new file mode 100644
index 0000000..2df1056
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+fn main_1() {
+ var x_1 : u32 = 42u;
+ let x_2 : u32 = x_1;
+ x_1 = x_2;
+ x_1 = x_2;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm
new file mode 100644
index 0000000..cf42eac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm
@@ -0,0 +1,36 @@
+; Test: SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+OpDecorate %myvar DescriptorSet 0
+OpDecorate %myvar Binding 0
+OpDecorate %_struct_4 BufferBlock
+OpMemberDecorate %_struct_4 0 Offset 0
+OpMemberDecorate %_struct_4 1 Offset 4
+OpDecorate %_runtimearr_uint ArrayStride 4
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+%_struct_4 = OpTypeStruct %uint %_runtimearr_uint
+%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4
+%_ptr_Uniform_uint = OpTypePointer Uniform %uint
+%myvar = OpVariable %_ptr_Uniform__struct_4 Uniform
+%_ptr_Uniform__runtimearr_uint = OpTypePointer Uniform %_runtimearr_uint
+%100 = OpFunction %void None %7
+%14 = OpLabel
+%1 = OpAccessChain %_ptr_Uniform__runtimearr_uint %myvar %uint_1
+%2 = OpAccessChain %_ptr_Uniform_uint %1 %uint_1
+OpStore %2 %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.hlsl
new file mode 100644
index 0000000..da24ebe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+RWByteAddressBuffer myvar : register(u0, space0);
+
+void main_1() {
+ myvar.Store(8u, asuint(0u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.msl
new file mode 100644
index 0000000..d0340a1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ /* 0x0000 */ uint field0;
+ /* 0x0004 */ uint field1[1];
+};
+
+void main_1(device S& myvar) {
+ myvar.field1[1u] = 0u;
+ return;
+}
+
+fragment void tint_symbol(device S& myvar [[buffer(0)]]) {
+ main_1(myvar);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.spvasm
new file mode 100644
index 0000000..6febe30
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpDecorate %_runtimearr_uint ArrayStride 4
+ OpDecorate %myvar DescriptorSet 0
+ OpDecorate %myvar Binding 0
+ %uint = OpTypeInt 32 0
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+ %S = OpTypeStruct %uint %_runtimearr_uint
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %myvar = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %6
+ %9 = OpLabel
+ %12 = OpAccessChain %_ptr_StorageBuffer_uint %myvar %uint_1 %uint_1
+ OpStore %12 %uint_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %6
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.wgsl
new file mode 100644
index 0000000..36d715b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+type RTArr = [[stride(4)]] array<u32>;
+
+[[block]]
+struct S {
+ field0 : u32;
+ field1 : RTArr;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+
+fn main_1() {
+ myvar.field1[1u] = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm
new file mode 100644
index 0000000..aceeb67
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm
@@ -0,0 +1,36 @@
+; Test: SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+OpDecorate %myvar DescriptorSet 0
+OpDecorate %myvar Binding 0
+OpDecorate %_struct_4 BufferBlock
+OpMemberDecorate %_struct_4 0 Offset 0
+OpMemberDecorate %_struct_4 1 Offset 4
+OpDecorate %_runtimearr_uint ArrayStride 4
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+%_struct_4 = OpTypeStruct %uint %_runtimearr_uint
+%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4
+%_ptr_Uniform_uint = OpTypePointer Uniform %uint
+%myvar = OpVariable %_ptr_Uniform__struct_4 Uniform
+%100 = OpFunction %void None %7
+%13 = OpLabel
+%1 = OpAccessChain %_ptr_Uniform_uint %myvar %uint_0
+OpStore %1 %uint_0
+%2 = OpAccessChain %_ptr_Uniform_uint %myvar %uint_1 %uint_1
+OpStore %2 %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.hlsl
new file mode 100644
index 0000000..1ad868f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+RWByteAddressBuffer myvar : register(u0, space0);
+
+void main_1() {
+ myvar.Store(0u, asuint(0u));
+ myvar.Store(8u, asuint(0u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.msl
new file mode 100644
index 0000000..a4a55e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ /* 0x0000 */ uint field0;
+ /* 0x0004 */ uint field1[1];
+};
+
+void main_1(device S& myvar) {
+ myvar.field0 = 0u;
+ myvar.field1[1u] = 0u;
+ return;
+}
+
+fragment void tint_symbol(device S& myvar [[buffer(0)]]) {
+ main_1(myvar);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.spvasm
new file mode 100644
index 0000000..476b04f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpDecorate %_runtimearr_uint ArrayStride 4
+ OpDecorate %myvar DescriptorSet 0
+ OpDecorate %myvar Binding 0
+ %uint = OpTypeInt 32 0
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+ %S = OpTypeStruct %uint %_runtimearr_uint
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %myvar = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %6
+ %9 = OpLabel
+ %12 = OpAccessChain %_ptr_StorageBuffer_uint %myvar %uint_0
+ OpStore %12 %uint_0
+ %14 = OpAccessChain %_ptr_StorageBuffer_uint %myvar %uint_1 %uint_1
+ OpStore %14 %uint_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %6
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.wgsl
new file mode 100644
index 0000000..8e3aa2e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+type RTArr = [[stride(4)]] array<u32>;
+
+[[block]]
+struct S {
+ field0 : u32;
+ field1 : RTArr;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+
+fn main_1() {
+ myvar.field0 = 0u;
+ myvar.field1[1u] = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm
new file mode 100644
index 0000000..ca072e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm
@@ -0,0 +1,36 @@
+; Test: SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+OpDecorate %myvar DescriptorSet 0
+OpDecorate %myvar Binding 0
+OpDecorate %_struct_4 BufferBlock
+OpMemberDecorate %_struct_4 0 Offset 0
+OpMemberDecorate %_struct_4 1 Offset 4
+OpDecorate %_runtimearr_uint ArrayStride 4
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+%_struct_4 = OpTypeStruct %uint %_runtimearr_uint
+%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4
+%_ptr_Uniform_uint = OpTypePointer Uniform %uint
+%myvar = OpVariable %_ptr_Uniform__struct_4 Uniform
+%100 = OpFunction %void None %7
+%13 = OpLabel
+%1 = OpInBoundsAccessChain %_ptr_Uniform_uint %myvar %uint_0
+OpStore %1 %uint_0
+%2 = OpInBoundsAccessChain %_ptr_Uniform_uint %myvar %uint_1 %uint_1
+OpStore %2 %uint_0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.hlsl
new file mode 100644
index 0000000..1ad868f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+RWByteAddressBuffer myvar : register(u0, space0);
+
+void main_1() {
+ myvar.Store(0u, asuint(0u));
+ myvar.Store(8u, asuint(0u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.msl
new file mode 100644
index 0000000..a4a55e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ /* 0x0000 */ uint field0;
+ /* 0x0004 */ uint field1[1];
+};
+
+void main_1(device S& myvar) {
+ myvar.field0 = 0u;
+ myvar.field1[1u] = 0u;
+ return;
+}
+
+fragment void tint_symbol(device S& myvar [[buffer(0)]]) {
+ main_1(myvar);
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.spvasm
new file mode 100644
index 0000000..476b04f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.spvasm
@@ -0,0 +1,44 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpDecorate %_runtimearr_uint ArrayStride 4
+ OpDecorate %myvar DescriptorSet 0
+ OpDecorate %myvar Binding 0
+ %uint = OpTypeInt 32 0
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+ %S = OpTypeStruct %uint %_runtimearr_uint
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %myvar = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+ %uint_1 = OpConstant %uint 1
+ %main_1 = OpFunction %void None %6
+ %9 = OpLabel
+ %12 = OpAccessChain %_ptr_StorageBuffer_uint %myvar %uint_0
+ OpStore %12 %uint_0
+ %14 = OpAccessChain %_ptr_StorageBuffer_uint %myvar %uint_1 %uint_1
+ OpStore %14 %uint_0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %6
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.wgsl
new file mode 100644
index 0000000..8e3aa2e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+type RTArr = [[stride(4)]] array<u32>;
+
+[[block]]
+struct S {
+ field0 : u32;
+ field1 : RTArr;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+
+fn main_1() {
+ myvar.field0 = 0u;
+ myvar.field1[1u] = 0u;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm
new file mode 100644
index 0000000..d24fcf1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm
@@ -0,0 +1,32 @@
+; Test: SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %myvar "myvar"
+OpDecorate %myvar DescriptorSet 0
+OpDecorate %myvar Binding 0
+OpDecorate %_struct_2 BufferBlock
+OpMemberDecorate %_struct_2 0 Offset 0
+OpMemberDecorate %_struct_2 1 Offset 4
+OpDecorate %_runtimearr_uint ArrayStride 4
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%uint_0 = OpConstant %uint 0
+%uint_1 = OpConstant %uint 1
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+%_struct_2 = OpTypeStruct %uint %_runtimearr_uint
+%_ptr_Uniform__struct_2 = OpTypePointer Uniform %_struct_2
+%_ptr_Uniform_uint = OpTypePointer Uniform %uint
+%myvar = OpVariable %_ptr_Uniform__struct_2 Uniform
+%100 = OpFunction %void None %5
+%11 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.hlsl
new file mode 100644
index 0000000..ef0855d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+RWByteAddressBuffer myvar : register(u0, space0);
+
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.msl
new file mode 100644
index 0000000..a15bf99
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ /* 0x0000 */ uint field0;
+ /* 0x0004 */ uint field1[1];
+};
+
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.spvasm
new file mode 100644
index 0000000..f6a41d8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpName %myvar "myvar"
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %S Block
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpDecorate %_runtimearr_uint ArrayStride 4
+ OpDecorate %myvar DescriptorSet 0
+ OpDecorate %myvar Binding 0
+ %uint = OpTypeInt 32 0
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+ %S = OpTypeStruct %uint %_runtimearr_uint
+%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
+ %myvar = OpVariable %_ptr_StorageBuffer_S StorageBuffer
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %6
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %6
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.wgsl
new file mode 100644
index 0000000..2f2d486
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+type RTArr = [[stride(4)]] array<u32>;
+
+[[block]]
+struct S {
+ field0 : u32;
+ field1 : RTArr;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> myvar : S;
+
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm
new file mode 100644
index 0000000..c3861cc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm
@@ -0,0 +1,26 @@
+; Test: SpvParserTestMiscInstruction_OpNop.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%100 = OpFunction %void None %2
+%11 = OpLabel
+OpNop
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.hlsl
new file mode 100644
index 0000000..1135368
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.spvasm
new file mode 100644
index 0000000..ca944f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.wgsl
new file mode 100644
index 0000000..471e2a6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm
new file mode 100644
index 0000000..6f70933
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm
@@ -0,0 +1,33 @@
+; Test: SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%1 = OpUndef %bool
+%2 = OpUndef %uint
+%3 = OpUndef %int
+%4 = OpUndef %float
+%100 = OpFunction %void None %6
+%19 = OpLabel
+%11 = OpCopyObject %bool %1
+%12 = OpCopyObject %uint %2
+%13 = OpCopyObject %int %3
+%14 = OpCopyObject %float %4
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..1c333fc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void main_1() {
+ const bool x_11 = false;
+ const uint x_12 = 0u;
+ const int x_13 = 0;
+ const float x_14 = 0.0f;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..b8ebf26
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_11 = false;
+ uint const x_12 = 0u;
+ int const x_13 = 0;
+ float const x_14 = 0.0f;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..39169de
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+ %float = OpTypeFloat 32
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..7f824c3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+fn main_1() {
+ let x_11 : bool = false;
+ let x_12 : u32 = 0u;
+ let x_13 : i32 = 0;
+ let x_14 : f32 = 0.0;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm
new file mode 100644
index 0000000..8be8717
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm
@@ -0,0 +1,33 @@
+; Test: SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%4 = OpUndef %v2bool
+%1 = OpUndef %v2uint
+%2 = OpUndef %v2int
+%3 = OpUndef %v2float
+%100 = OpFunction %void None %6
+%19 = OpLabel
+%14 = OpCopyObject %v2bool %4
+%11 = OpCopyObject %v2uint %1
+%12 = OpCopyObject %v2int %2
+%13 = OpCopyObject %v2float %3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..f48d969
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void main_1() {
+ const bool2 x_14 = bool2(false, false);
+ const uint2 x_11 = uint2(0u, 0u);
+ const int2 x_12 = int2(0, 0);
+ const float2 x_13 = float2(0.0f, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..2c5087c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_14 = bool2(false, false);
+ uint2 const x_11 = uint2(0u, 0u);
+ int2 const x_12 = int2(0, 0);
+ float2 const x_13 = float2(0.0f, 0.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..34b50e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %false = OpConstantFalse %bool
+ %8 = OpConstantComposite %v2bool %false %false
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_0 = OpConstant %uint 0
+ %12 = OpConstantComposite %v2uint %uint_0 %uint_0
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_0 = OpConstant %int 0
+ %16 = OpConstantComposite %v2int %int_0 %int_0
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_0 = OpConstant %float 0
+ %20 = OpConstantComposite %v2float %float_0 %float_0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..16e44de
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+fn main_1() {
+ let x_14 : vec2<bool> = vec2<bool>(false, false);
+ let x_11 : vec2<u32> = vec2<u32>(0u, 0u);
+ let x_12 : vec2<i32> = vec2<i32>(0, 0);
+ let x_13 : vec2<f32> = vec2<f32>(0.0, 0.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm
new file mode 100644
index 0000000..af00c2d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+%100 = OpFunction %void None %3
+%15 = OpLabel
+%1 = OpUndef %_arr_uint_uint_2
+%11 = OpCopyObject %_arr_uint_uint_2 %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.hlsl
new file mode 100644
index 0000000..e2dc20c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_11[2] = {0u, 0u};
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.msl
new file mode 100644
index 0000000..c1cb8ea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_array_wrapper {
+ uint arr[2];
+};
+
+void main_1() {
+ tint_array_wrapper const x_11 = {.arr={0u, 0u}};
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.spvasm
new file mode 100644
index 0000000..65a7f77
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_2 ArrayStride 4
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
+ %uint_0 = OpConstant %uint 0
+ %9 = OpConstantComposite %_arr_uint_uint_2 %uint_0 %uint_0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.wgsl
new file mode 100644
index 0000000..1b75341
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_11 : array<u32, 2> = array<u32, 2>(0u, 0u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm
new file mode 100644
index 0000000..07161e1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat2v2float = OpTypeMatrix %v2float 2
+%100 = OpFunction %void None %3
+%14 = OpLabel
+%1 = OpUndef %mat2v2float
+%11 = OpCopyObject %mat2v2float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.hlsl
new file mode 100644
index 0000000..33b9a66
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float2x2 x_11 = float2x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.msl
new file mode 100644
index 0000000..39e9c10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2x2 const x_11 = float2x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.spvasm
new file mode 100644
index 0000000..5d8aff4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat2v2float = OpTypeMatrix %v2float 2
+ %float_0 = OpConstant %float 0
+ %9 = OpConstantComposite %v2float %float_0 %float_0
+ %10 = OpConstantComposite %mat2v2float %9 %9
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.wgsl
new file mode 100644
index 0000000..8a02cce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_11 : mat2x2<f32> = mat2x2<f32>(vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm
new file mode 100644
index 0000000..067ea47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm
@@ -0,0 +1,33 @@
+; Test: SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%100 = OpFunction %void None %6
+%19 = OpLabel
+%1 = OpUndef %bool
+%2 = OpUndef %uint
+%3 = OpUndef %int
+%4 = OpUndef %float
+%11 = OpCopyObject %bool %1
+%12 = OpCopyObject %uint %2
+%13 = OpCopyObject %int %3
+%14 = OpCopyObject %float %4
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..1c333fc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void main_1() {
+ const bool x_11 = false;
+ const uint x_12 = 0u;
+ const int x_13 = 0;
+ const float x_14 = 0.0f;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..b8ebf26
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_11 = false;
+ uint const x_12 = 0u;
+ int const x_13 = 0;
+ float const x_14 = 0.0f;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..39169de
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+ %float = OpTypeFloat 32
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..7f824c3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+fn main_1() {
+ let x_11 : bool = false;
+ let x_12 : u32 = 0u;
+ let x_13 : i32 = 0;
+ let x_14 : f32 = 0.0;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm
new file mode 100644
index 0000000..798ef1f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%_struct_13 = OpTypeStruct %bool %uint %int %float
+%100 = OpFunction %void None %3
+%14 = OpLabel
+%1 = OpUndef %_struct_13
+%11 = OpCopyObject %_struct_13 %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.hlsl
new file mode 100644
index 0000000..1e627e26
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+struct S {
+ bool field0;
+ uint field1;
+ int field2;
+ float field3;
+};
+
+void main_1() {
+ const S x_11 = {false, 0u, 0, 0.0f};
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.msl
new file mode 100644
index 0000000..062b737
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ bool field0;
+ uint field1;
+ int field2;
+ float field3;
+};
+
+void main_1() {
+ S const x_11 = {.field0=false, .field1=0u, .field2=0, .field3=0.0f};
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.spvasm
new file mode 100644
index 0000000..6843c11
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.spvasm
@@ -0,0 +1,41 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpMemberName %S 3 "field3"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 4
+ OpMemberDecorate %S 2 Offset 8
+ OpMemberDecorate %S 3 Offset 12
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %float = OpTypeFloat 32
+ %S = OpTypeStruct %bool %uint %int %float
+ %false = OpConstantFalse %bool
+ %uint_0 = OpConstant %uint 0
+ %int_0 = OpConstant %int 0
+ %float_0 = OpConstant %float 0
+ %14 = OpConstantComposite %S %false %uint_0 %int_0 %float_0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.wgsl
new file mode 100644
index 0000000..2ace22b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+struct S {
+ field0 : bool;
+ field1 : u32;
+ field2 : i32;
+ field3 : f32;
+};
+
+fn main_1() {
+ let x_11 : S = S(false, 0u, 0, 0.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm
new file mode 100644
index 0000000..031659c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm
@@ -0,0 +1,31 @@
+; Test: SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%100 = OpFunction %void None %5
+%17 = OpLabel
+%1 = OpUndef %v2uint
+%2 = OpUndef %v2int
+%3 = OpUndef %v2float
+%11 = OpCopyObject %v2uint %1
+%12 = OpCopyObject %v2int %2
+%13 = OpCopyObject %v2float %3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..622822c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ const uint2 x_11 = uint2(0u, 0u);
+ const int2 x_12 = int2(0, 0);
+ const float2 x_13 = float2(0.0f, 0.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..ed0c516
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_11 = uint2(0u, 0u);
+ int2 const x_12 = int2(0, 0);
+ float2 const x_13 = float2(0.0f, 0.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..18b0836
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_0 = OpConstant %uint 0
+ %8 = OpConstantComposite %v2uint %uint_0 %uint_0
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_0 = OpConstant %int 0
+ %12 = OpConstantComposite %v2int %int_0 %int_0
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_0 = OpConstant %float 0
+ %16 = OpConstantComposite %v2float %float_0 %float_0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..b77d651
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.wgsl
@@ -0,0 +1,11 @@
+fn main_1() {
+ let x_11 : vec2<u32> = vec2<u32>(0u, 0u);
+ let x_12 : vec2<i32> = vec2<i32>(0, 0);
+ let x_13 : vec2<f32> = vec2<f32>(0.0, 0.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..bcbb92d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseAnd %uint %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..8daeff3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint((30 & asint(10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..09866c1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>((30 & as_type<int>(10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..d86103d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpBitcast %int %uint_10
+ %11 = OpBitwiseAnd %int %int_30 %9
+ %5 = OpBitcast %uint %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..28cdc31
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>((30 & bitcast<i32>(10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..ca043cf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseAnd %int %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..ccbe5e6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 & asint(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..7185ce3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 & as_type<int>(10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..974aae3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_10
+ %10 = OpBitwiseAnd %int %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..8b6ccf6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 & bitcast<i32>(10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..92a9458
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseAnd %uint %uint_10 %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..35fff8a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u & asuint(30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..9b39fed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u & as_type<uint>(30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..0439ab7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_30
+ %10 = OpBitwiseAnd %uint %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..ede5ddd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u & bitcast<u32>(30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..3182a5e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseAnd %int %uint_20 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..267c570
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = asint((20u & 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..7e6d49c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = as_type<int>((20u & 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..dacfa9a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitwiseAnd %uint %uint_20 %uint_10
+ %5 = OpBitcast %int %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..ddd452a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = bitcast<i32>((20u & 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..0abe734
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseAnd %v2uint %21 %19
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..35f97f3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint((int2(30, 40) & asint(uint2(10u, 20u))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..5d6a845
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>((int2(30, 40) & as_type<int2>(uint2(10u, 20u))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..5e37605
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %16 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2int %16
+ %17 = OpBitwiseAnd %v2int %12 %13
+ %5 = OpBitcast %v2uint %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..15cf3a7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30, 40) & bitcast<vec2<i32>>(vec2<u32>(10u, 20u))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..eea09d6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseAnd %v2int %19 %22
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..6dcfce8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = asint((uint2(10u, 20u) & asuint(int2(40, 30))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..25561f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = as_type<int2>((uint2(10u, 20u) & as_type<uint2>(int2(40, 30))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..4fcbe33
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %16 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2uint %16
+ %17 = OpBitwiseAnd %v2uint %12 %13
+ %5 = OpBitcast %v2int %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..599291f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = bitcast<vec2<i32>>((vec2<u32>(10u, 20u) & bitcast<vec2<u32>>(vec2<i32>(40, 30))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..64b8ee3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseAnd %uint %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..6fd61f1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u & 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..4857fea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u & 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..c0acca2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpBitwiseAnd %uint %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..fa96560
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u & 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..4bd5b0e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseAnd %int %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..069f035
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 & 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..9c2ddb4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 & 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..87fc4f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpBitwiseAnd %int %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..e4fe605
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 & 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..4591990
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseAnd %v2uint %19 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..61c9c17
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (uint2(10u, 20u) & uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..35af63a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = (uint2(10u, 20u) & uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..bf1ec0d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpBitwiseAnd %v2uint %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..92d0c5b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = (vec2<u32>(10u, 20u) & vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..b88275e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseAnd %v2int %21 %22
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..777dfba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(30, 40) & int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..244225b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(30, 40) & int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..2956339
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpBitwiseAnd %v2int %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..b67e732
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(30, 40) & vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..fdaa844
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseOr %uint %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..af5bd3d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint((30 | asint(10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..43972ab
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>((30 | as_type<int>(10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..6263cce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpBitcast %int %uint_10
+ %11 = OpBitwiseOr %int %int_30 %9
+ %5 = OpBitcast %uint %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..c574be1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>((30 | bitcast<i32>(10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..d23f276
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseOr %int %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..fbb2d3d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 | asint(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..161017d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 | as_type<int>(10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..3240ac4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_10
+ %10 = OpBitwiseOr %int %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..4e8ebb1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 | bitcast<i32>(10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..b35ccd0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseOr %uint %uint_10 %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..fe7026f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u | asuint(30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..7303545
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u | as_type<uint>(30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..f9b9023
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_30
+ %10 = OpBitwiseOr %uint %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..8a4c1d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u | bitcast<u32>(30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..ab0c1cb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseOr %int %uint_20 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..dbc5745
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = asint((20u | 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..ba5554c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = as_type<int>((20u | 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..0e7eac2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitwiseOr %uint %uint_20 %uint_10
+ %5 = OpBitcast %int %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..b291348
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = bitcast<i32>((20u | 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..9ff8af4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseOr %v2uint %21 %19
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..0334e75
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint((int2(30, 40) | asint(uint2(10u, 20u))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..d445f70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>((int2(30, 40) | as_type<int2>(uint2(10u, 20u))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..214b8c0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %16 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2int %16
+ %17 = OpBitwiseOr %v2int %12 %13
+ %5 = OpBitcast %v2uint %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..7e05596
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30, 40) | bitcast<vec2<i32>>(vec2<u32>(10u, 20u))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..6d0c1ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseOr %v2int %19 %22
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..1e2f655
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = asint((uint2(10u, 20u) | asuint(int2(40, 30))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..3dee84f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = as_type<int2>((uint2(10u, 20u) | as_type<uint2>(int2(40, 30))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..c56abb4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %16 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2uint %16
+ %17 = OpBitwiseOr %v2uint %12 %13
+ %5 = OpBitcast %v2int %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..fe7e851
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = bitcast<vec2<i32>>((vec2<u32>(10u, 20u) | bitcast<vec2<u32>>(vec2<i32>(40, 30))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..ebccc77
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseOr %uint %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..33a7f6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u | 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..dd24d81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u | 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..e6efbf2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpBitwiseOr %uint %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..86bf584
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u | 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..c5eae25
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseOr %int %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..0f8b9c6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 | 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..09800fd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 | 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..2f91c36
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpBitwiseOr %int %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..4810762
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 | 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..c4177ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseOr %v2uint %19 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..bd2b6f3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (uint2(10u, 20u) | uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..d37cfab
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = (uint2(10u, 20u) | uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..729dcb4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpBitwiseOr %v2uint %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..de8cdec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = (vec2<u32>(10u, 20u) | vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..bb224ab
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseOr %v2int %21 %22
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..34cc261
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(30, 40) | int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..0e2c805
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(30, 40) | int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..329413f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpBitwiseOr %v2int %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..02f76d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(30, 40) | vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..87fe6d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseXor %uint %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..f084e8d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint((30 ^ asint(10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..2beff4c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>((30 ^ as_type<int>(10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..9af7f7e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpBitcast %int %uint_10
+ %11 = OpBitwiseXor %int %int_30 %9
+ %5 = OpBitcast %uint %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..5d4ebcb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>((30 ^ bitcast<i32>(10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..f520a70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseXor %int %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..ce0016b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 ^ asint(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..1bd1ed6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 ^ as_type<int>(10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..93f031a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_10
+ %10 = OpBitwiseXor %int %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..d728e06
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 ^ bitcast<i32>(10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..c31022a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseXor %uint %uint_10 %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..96dfbcc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u ^ asuint(30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..e4a4633
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u ^ as_type<uint>(30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..13f74a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_30
+ %10 = OpBitwiseXor %uint %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..9a7ed2c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u ^ bitcast<u32>(30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..b14860b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseXor %int %uint_20 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..49b03a7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = asint((20u ^ 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..5069e92
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = as_type<int>((20u ^ 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..63b8a51
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitwiseXor %uint %uint_20 %uint_10
+ %5 = OpBitcast %int %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..13df578
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = bitcast<i32>((20u ^ 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..e33f645
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseXor %v2uint %21 %19
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..589ccb9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint((int2(30, 40) ^ asint(uint2(10u, 20u))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..c17bc8a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>((int2(30, 40) ^ as_type<int2>(uint2(10u, 20u))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..cb26191
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %16 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2int %16
+ %17 = OpBitwiseXor %v2int %12 %13
+ %5 = OpBitcast %v2uint %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..25238d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30, 40) ^ bitcast<vec2<i32>>(vec2<u32>(10u, 20u))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..a33d6cb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseXor %v2int %19 %22
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..0bc9085
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = asint((uint2(10u, 20u) ^ asuint(int2(40, 30))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..1b587bf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = as_type<int2>((uint2(10u, 20u) ^ as_type<uint2>(int2(40, 30))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..6abc053
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %16 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2uint %16
+ %17 = OpBitwiseXor %v2uint %12 %13
+ %5 = OpBitcast %v2int %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..aedf862
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = bitcast<vec2<i32>>((vec2<u32>(10u, 20u) ^ bitcast<vec2<u32>>(vec2<i32>(40, 30))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..39ec72d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseXor %uint %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..5cb2f7b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u ^ 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..7b580d9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u ^ 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..ab87cf7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpBitwiseXor %uint %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..7640633
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u ^ 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..7409b70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseXor %int %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..b086603
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 ^ 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..9a6691b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 ^ 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..1de9101
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpBitwiseXor %int %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..bff8479
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 ^ 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..ecafc47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseXor %v2uint %19 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..f318a1f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (uint2(10u, 20u) ^ uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..3949abf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = (uint2(10u, 20u) ^ uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..bf9d7fb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpBitwiseXor %v2uint %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..2f68b93
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = (vec2<u32>(10u, 20u) ^ vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..8f13483
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpBitwiseXor %v2int %21 %22
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..e1c2b26
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(30, 40) ^ int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..68ab203
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(30, 40) ^ int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..7ff16f1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpBitwiseXor %v2int %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..fa65cd2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(30, 40) ^ vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm
new file mode 100644
index 0000000..eab3405
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserTest_CompositeExtract_Array.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%25 = OpConstantNull %mat3v2float
+%_struct_26 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%28 = OpConstantComposite %v2uint %uint_3 %uint_4
+%29 = OpConstantComposite %v2uint %uint_4 %uint_3
+%30 = OpConstantComposite %v2float %float_50 %float_60
+%31 = OpConstantComposite %v2float %float_60 %float_50
+%32 = OpConstantComposite %v2float %float_70 %float_70
+%_ptr_Function__arr_uint_uint_5 = OpTypePointer Function %_arr_uint_uint_5
+%100 = OpFunction %void None %4
+%34 = OpLabel
+%35 = OpVariable %_ptr_Function__arr_uint_uint_5 Function
+%1 = OpLoad %_arr_uint_uint_5 %35
+%2 = OpCompositeExtract %uint %1 3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.hlsl
new file mode 100644
index 0000000..05d43e2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ uint x_35[5] = (uint[5])0;
+ const uint x_2 = x_35[3u];
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.msl
new file mode 100644
index 0000000..fa5ff1b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+struct tint_array_wrapper {
+ uint arr[5];
+};
+
+void main_1() {
+ tint_array_wrapper x_35 = {};
+ tint_array_wrapper const x_1 = x_35;
+ uint const x_2 = x_1.arr[3u];
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.spvasm
new file mode 100644
index 0000000..3b9cb09
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %x_35 "x_35"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_5 ArrayStride 4
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_5 = OpConstant %uint 5
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%_ptr_Function__arr_uint_uint_5 = OpTypePointer Function %_arr_uint_uint_5
+ %10 = OpConstantNull %_arr_uint_uint_5
+ %uint_3 = OpConstant %uint 3
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_35 = OpVariable %_ptr_Function__arr_uint_uint_5 Function %10
+ %11 = OpLoad %_arr_uint_uint_5 %x_35
+ %13 = OpCompositeExtract %uint %11 3
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.wgsl
new file mode 100644
index 0000000..f5ddf63
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ var x_35 : array<u32, 5>;
+ let x_1 : array<u32, 5> = x_35;
+ let x_2 : u32 = x_1[3u];
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm
new file mode 100644
index 0000000..41a755a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserTest_CompositeExtract_Matrix.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%25 = OpConstantNull %mat3v2float
+%_struct_26 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%28 = OpConstantComposite %v2uint %uint_3 %uint_4
+%29 = OpConstantComposite %v2uint %uint_4 %uint_3
+%30 = OpConstantComposite %v2float %float_50 %float_60
+%31 = OpConstantComposite %v2float %float_60 %float_50
+%32 = OpConstantComposite %v2float %float_70 %float_70
+%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
+%100 = OpFunction %void None %4
+%34 = OpLabel
+%35 = OpVariable %_ptr_Function_mat3v2float Function
+%1 = OpLoad %mat3v2float %35
+%2 = OpCompositeExtract %v2float %1 2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.hlsl
new file mode 100644
index 0000000..89799a1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ float3x2 x_35 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+ const float2 x_2 = x_35[2u];
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.msl
new file mode 100644
index 0000000..5ca2e35
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ float3x2 x_35 = float3x2(0.0f);
+ float3x2 const x_1 = x_35;
+ float2 const x_2 = x_1[2u];
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.spvasm
new file mode 100644
index 0000000..ad6e65c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %x_35 "x_35"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
+ %10 = OpConstantNull %mat3v2float
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_35 = OpVariable %_ptr_Function_mat3v2float Function %10
+ %11 = OpLoad %mat3v2float %x_35
+ %14 = OpCompositeExtract %v2float %11 2
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.wgsl
new file mode 100644
index 0000000..8dc1f71
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ var x_35 : mat3x2<f32>;
+ let x_1 : mat3x2<f32> = x_35;
+ let x_2 : vec2<f32> = x_1[2u];
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm
new file mode 100644
index 0000000..179fc5e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserTest_CompositeExtract_Matrix_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%25 = OpConstantNull %mat3v2float
+%_struct_26 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%28 = OpConstantComposite %v2uint %uint_3 %uint_4
+%29 = OpConstantComposite %v2uint %uint_4 %uint_3
+%30 = OpConstantComposite %v2float %float_50 %float_60
+%31 = OpConstantComposite %v2float %float_60 %float_50
+%32 = OpConstantComposite %v2float %float_70 %float_70
+%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
+%100 = OpFunction %void None %4
+%34 = OpLabel
+%35 = OpVariable %_ptr_Function_mat3v2float Function
+%1 = OpLoad %mat3v2float %35
+%2 = OpCompositeExtract %float %1 2 1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..8a1c2e1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ float3x2 x_35 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+ const float x_2 = x_35[2u].y;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..0030961
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ float3x2 x_35 = float3x2(0.0f);
+ float3x2 const x_1 = x_35;
+ float const x_2 = x_1[2u].y;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..7fe8e86
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %x_35 "x_35"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
+ %10 = OpConstantNull %mat3v2float
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_35 = OpVariable %_ptr_Function_mat3v2float Function %10
+ %11 = OpLoad %mat3v2float %x_35
+ %14 = OpCompositeExtract %v2float %11 2
+ %15 = OpCompositeExtract %float %14 1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..eceabfb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ var x_35 : mat3x2<f32>;
+ let x_1 : mat3x2<f32> = x_35;
+ let x_2 : f32 = x_1[2u].y;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm
new file mode 100644
index 0000000..e67fef7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserTest_CompositeExtract_Struct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%25 = OpConstantNull %mat3v2float
+%_struct_26 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%28 = OpConstantComposite %v2uint %uint_3 %uint_4
+%29 = OpConstantComposite %v2uint %uint_4 %uint_3
+%30 = OpConstantComposite %v2float %float_50 %float_60
+%31 = OpConstantComposite %v2float %float_60 %float_50
+%32 = OpConstantComposite %v2float %float_70 %float_70
+%_ptr_Function__struct_26 = OpTypePointer Function %_struct_26
+%100 = OpFunction %void None %4
+%34 = OpLabel
+%35 = OpVariable %_ptr_Function__struct_26 Function
+%1 = OpLoad %_struct_26 %35
+%2 = OpCompositeExtract %int %1 2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.hlsl
new file mode 100644
index 0000000..2c66421
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ S x_35 = (S)0;
+ const int x_2 = x_35.field2;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.msl
new file mode 100644
index 0000000..3aef306
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ S x_35 = {};
+ S const x_1 = x_35;
+ int const x_2 = x_1.field2;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.spvasm
new file mode 100644
index 0000000..5e02b6c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpName %x_35 "x_35"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 8
+ OpMemberDecorate %S 2 Offset 12
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %S = OpTypeStruct %v2float %uint %int
+%_ptr_Function_S = OpTypePointer Function %S
+ %12 = OpConstantNull %S
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_35 = OpVariable %_ptr_Function_S Function %12
+ %13 = OpLoad %S %x_35
+ %14 = OpCompositeExtract %int %13 2
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.wgsl
new file mode 100644
index 0000000..39ef3eb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ var x_35 : S;
+ let x_1 : S = x_35;
+ let x_2 : i32 = x_1.field2;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm
new file mode 100644
index 0000000..ce37349
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%25 = OpConstantNull %mat3v2float
+%_struct_26 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%28 = OpConstantComposite %v2uint %uint_3 %uint_4
+%29 = OpConstantComposite %v2uint %uint_4 %uint_3
+%30 = OpConstantComposite %v2float %float_50 %float_60
+%31 = OpConstantComposite %v2float %float_60 %float_50
+%32 = OpConstantComposite %v2float %float_70 %float_70
+%_arr_mat3v2float_uint_3 = OpTypeArray %mat3v2float %uint_3
+%_struct_34 = OpTypeStruct %uint %_arr_mat3v2float_uint_3
+%_ptr_Function__struct_34 = OpTypePointer Function %_struct_34
+%100 = OpFunction %void None %4
+%36 = OpLabel
+%37 = OpVariable %_ptr_Function__struct_34 Function
+%1 = OpLoad %_struct_34 %37
+%2 = OpCompositeExtract %float %1 1 2 0 1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..bc08b10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+struct S_1 {
+ uint field0;
+ float3x2 field1[3];
+};
+
+void main_1() {
+ S_1 x_37 = (S_1)0;
+ const float x_2 = x_37.field1[2u][0u].y;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..848baf7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.msl
@@ -0,0 +1,28 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+struct tint_array_wrapper {
+ float3x2 arr[3];
+};
+struct S_1 {
+ uint field0;
+ tint_array_wrapper field1;
+};
+
+void main_1() {
+ S_1 x_37 = {};
+ S_1 const x_1 = x_37;
+ float const x_2 = x_1.field1.arr[2u][0u].y;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..27b9be7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.spvasm
@@ -0,0 +1,48 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %S_1 "S_1"
+ OpMemberName %S_1 0 "field0"
+ OpMemberName %S_1 1 "field1"
+ OpName %x_37 "x_37"
+ OpName %main "main"
+ OpMemberDecorate %S_1 0 Offset 0
+ OpMemberDecorate %S_1 1 Offset 8
+ OpMemberDecorate %S_1 1 ColMajor
+ OpMemberDecorate %S_1 1 MatrixStride 8
+ OpDecorate %_arr_mat3v2float_uint_3 ArrayStride 24
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+ %uint_3 = OpConstant %uint 3
+%_arr_mat3v2float_uint_3 = OpTypeArray %mat3v2float %uint_3
+ %S_1 = OpTypeStruct %uint %_arr_mat3v2float_uint_3
+%_ptr_Function_S_1 = OpTypePointer Function %S_1
+ %14 = OpConstantNull %S_1
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_37 = OpVariable %_ptr_Function_S_1 Function %14
+ %15 = OpLoad %S_1 %x_37
+ %16 = OpCompositeExtract %_arr_mat3v2float_uint_3 %15 1
+ %18 = OpCompositeExtract %mat3v2float %16 2
+ %20 = OpCompositeExtract %v2float %18 0
+ %21 = OpCompositeExtract %float %20 1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..4279fe1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+struct S_1 {
+ field0 : u32;
+ field1 : array<mat3x2<f32>, 3>;
+};
+
+fn main_1() {
+ var x_37 : S_1;
+ let x_1 : S_1 = x_37;
+ let x_2 : f32 = x_1.field1[2u][0u].y;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm
new file mode 100644
index 0000000..971f743
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserTest_CompositeExtract_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%24 = OpConstantNull %mat3v2float
+%_struct_25 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%27 = OpConstantComposite %v2uint %uint_3 %uint_4
+%28 = OpConstantComposite %v2uint %uint_4 %uint_3
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%31 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %3
+%32 = OpLabel
+%1 = OpCompositeExtract %float %29 1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..36759a1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float x_1 = float2(50.0f, 60.0f).y;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..246c468
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ float const x_1 = float2(50.0f, 60.0f).y;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..219e36a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpCompositeExtract %float %9 1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..55863bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ let x_1 : f32 = vec2<f32>(50.0, 60.0).y;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm
new file mode 100644
index 0000000..38c0d5b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserTest_CompositeInsert_Array.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%25 = OpConstantNull %mat3v2float
+%_struct_26 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%28 = OpConstantComposite %v2uint %uint_3 %uint_4
+%29 = OpConstantComposite %v2uint %uint_4 %uint_3
+%30 = OpConstantComposite %v2float %float_50 %float_60
+%31 = OpConstantComposite %v2float %float_60 %float_50
+%32 = OpConstantComposite %v2float %float_70 %float_70
+%_ptr_Function__arr_uint_uint_5 = OpTypePointer Function %_arr_uint_uint_5
+%100 = OpFunction %void None %4
+%34 = OpLabel
+%35 = OpVariable %_ptr_Function__arr_uint_uint_5 Function
+%1 = OpLoad %_arr_uint_uint_5 %35
+%2 = OpCompositeInsert %_arr_uint_uint_5 %uint_20 %1 3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.hlsl
new file mode 100644
index 0000000..19178b2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+void main_1() {
+ uint x_35[5] = (uint[5])0;
+ uint x_2_1[5] = x_35;
+ x_2_1[3u] = 20u;
+ const uint x_2[5] = x_2_1;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.msl
new file mode 100644
index 0000000..dcaff85
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+struct tint_array_wrapper {
+ uint arr[5];
+};
+
+void main_1() {
+ tint_array_wrapper x_35 = {};
+ tint_array_wrapper const x_1 = x_35;
+ tint_array_wrapper x_2_1 = x_1;
+ x_2_1.arr[3u] = 20u;
+ tint_array_wrapper const x_2 = x_2_1;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.spvasm
new file mode 100644
index 0000000..2e5dcd5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %x_35 "x_35"
+ OpName %x_2_1 "x_2_1"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_5 ArrayStride 4
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_5 = OpConstant %uint 5
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%_ptr_Function__arr_uint_uint_5 = OpTypePointer Function %_arr_uint_uint_5
+ %10 = OpConstantNull %_arr_uint_uint_5
+ %uint_3 = OpConstant %uint 3
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_35 = OpVariable %_ptr_Function__arr_uint_uint_5 Function %10
+ %x_2_1 = OpVariable %_ptr_Function__arr_uint_uint_5 Function %10
+ %11 = OpLoad %_arr_uint_uint_5 %x_35
+ OpStore %x_2_1 %11
+ %15 = OpAccessChain %_ptr_Function_uint %x_2_1 %uint_3
+ OpStore %15 %uint_20
+ %17 = OpLoad %_arr_uint_uint_5 %x_2_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.wgsl
new file mode 100644
index 0000000..5ce5820
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ var x_35 : array<u32, 5>;
+ let x_1 : array<u32, 5> = x_35;
+ var x_2_1 : array<u32, 5> = x_1;
+ x_2_1[3u] = 20u;
+ let x_2 : array<u32, 5> = x_2_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm
new file mode 100644
index 0000000..18a4662
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserTest_CompositeInsert_Matrix.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%25 = OpConstantNull %mat3v2float
+%_struct_26 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%28 = OpConstantComposite %v2uint %uint_3 %uint_4
+%29 = OpConstantComposite %v2uint %uint_4 %uint_3
+%30 = OpConstantComposite %v2float %float_50 %float_60
+%31 = OpConstantComposite %v2float %float_60 %float_50
+%32 = OpConstantComposite %v2float %float_70 %float_70
+%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
+%100 = OpFunction %void None %4
+%34 = OpLabel
+%35 = OpVariable %_ptr_Function_mat3v2float Function
+%1 = OpLoad %mat3v2float %35
+%2 = OpCompositeInsert %mat3v2float %30 %1 2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.hlsl
new file mode 100644
index 0000000..a70ffdd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+void main_1() {
+ float3x2 x_35 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+ float3x2 x_2_1 = x_35;
+ x_2_1[2u] = float2(50.0f, 60.0f);
+ const float3x2 x_2 = x_2_1;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.msl
new file mode 100644
index 0000000..794de75
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ float3x2 x_35 = float3x2(0.0f);
+ float3x2 const x_1 = x_35;
+ float3x2 x_2_1 = x_1;
+ x_2_1[2u] = float2(50.0f, 60.0f);
+ float3x2 const x_2 = x_2_1;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.spvasm
new file mode 100644
index 0000000..5517818
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %x_35 "x_35"
+ OpName %x_2_1 "x_2_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
+ %10 = OpConstantNull %mat3v2float
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %19 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_35 = OpVariable %_ptr_Function_mat3v2float Function %10
+ %x_2_1 = OpVariable %_ptr_Function_mat3v2float Function %10
+ %11 = OpLoad %mat3v2float %x_35
+ OpStore %x_2_1 %11
+ %16 = OpAccessChain %_ptr_Function_v2float %x_2_1 %uint_2
+ OpStore %16 %19
+ %20 = OpLoad %mat3v2float %x_2_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.wgsl
new file mode 100644
index 0000000..2816a96
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ var x_35 : mat3x2<f32>;
+ let x_1 : mat3x2<f32> = x_35;
+ var x_2_1 : mat3x2<f32> = x_1;
+ x_2_1[2u] = vec2<f32>(50.0, 60.0);
+ let x_2 : mat3x2<f32> = x_2_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm
new file mode 100644
index 0000000..111b10b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserTest_CompositeInsert_Matrix_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%25 = OpConstantNull %mat3v2float
+%_struct_26 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%28 = OpConstantComposite %v2uint %uint_3 %uint_4
+%29 = OpConstantComposite %v2uint %uint_4 %uint_3
+%30 = OpConstantComposite %v2float %float_50 %float_60
+%31 = OpConstantComposite %v2float %float_60 %float_50
+%32 = OpConstantComposite %v2float %float_70 %float_70
+%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
+%100 = OpFunction %void None %4
+%34 = OpLabel
+%35 = OpVariable %_ptr_Function_mat3v2float Function
+%1 = OpLoad %mat3v2float %35
+%2 = OpCompositeInsert %mat3v2float %30 %1 2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..a70ffdd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+void main_1() {
+ float3x2 x_35 = float3x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+ float3x2 x_2_1 = x_35;
+ x_2_1[2u] = float2(50.0f, 60.0f);
+ const float3x2 x_2 = x_2_1;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..794de75
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ float3x2 x_35 = float3x2(0.0f);
+ float3x2 const x_1 = x_35;
+ float3x2 x_2_1 = x_1;
+ x_2_1[2u] = float2(50.0f, 60.0f);
+ float3x2 const x_2 = x_2_1;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..5517818
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %x_35 "x_35"
+ OpName %x_2_1 "x_2_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
+ %10 = OpConstantNull %mat3v2float
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %19 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_35 = OpVariable %_ptr_Function_mat3v2float Function %10
+ %x_2_1 = OpVariable %_ptr_Function_mat3v2float Function %10
+ %11 = OpLoad %mat3v2float %x_35
+ OpStore %x_2_1 %11
+ %16 = OpAccessChain %_ptr_Function_v2float %x_2_1 %uint_2
+ OpStore %16 %19
+ %20 = OpLoad %mat3v2float %x_2_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..2816a96
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ var x_35 : mat3x2<f32>;
+ let x_1 : mat3x2<f32> = x_35;
+ var x_2_1 : mat3x2<f32> = x_1;
+ x_2_1[2u] = vec2<f32>(50.0, 60.0);
+ let x_2 : mat3x2<f32> = x_2_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm
new file mode 100644
index 0000000..10d58e1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserTest_CompositeInsert_Struct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%25 = OpConstantNull %mat3v2float
+%_struct_26 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%28 = OpConstantComposite %v2uint %uint_3 %uint_4
+%29 = OpConstantComposite %v2uint %uint_4 %uint_3
+%30 = OpConstantComposite %v2float %float_50 %float_60
+%31 = OpConstantComposite %v2float %float_60 %float_50
+%32 = OpConstantComposite %v2float %float_70 %float_70
+%_ptr_Function__struct_26 = OpTypePointer Function %_struct_26
+%100 = OpFunction %void None %4
+%34 = OpLabel
+%35 = OpVariable %_ptr_Function__struct_26 Function
+%1 = OpLoad %_struct_26 %35
+%2 = OpCompositeInsert %_struct_26 %int_30 %1 2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.hlsl
new file mode 100644
index 0000000..b7cd046
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ S x_35 = (S)0;
+ S x_2_1 = x_35;
+ x_2_1.field2 = 30;
+ const S x_2 = x_2_1;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.msl
new file mode 100644
index 0000000..a09c526
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.msl
@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ S x_35 = {};
+ S const x_1 = x_35;
+ S x_2_1 = x_1;
+ x_2_1.field2 = 30;
+ S const x_2 = x_2_1;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.spvasm
new file mode 100644
index 0000000..d81b001
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.spvasm
@@ -0,0 +1,48 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpName %x_35 "x_35"
+ OpName %x_2_1 "x_2_1"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 8
+ OpMemberDecorate %S 2 Offset 12
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %S = OpTypeStruct %v2float %uint %int
+%_ptr_Function_S = OpTypePointer Function %S
+ %12 = OpConstantNull %S
+ %uint_2 = OpConstant %uint 2
+%_ptr_Function_int = OpTypePointer Function %int
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_35 = OpVariable %_ptr_Function_S Function %12
+ %x_2_1 = OpVariable %_ptr_Function_S Function %12
+ %13 = OpLoad %S %x_35
+ OpStore %x_2_1 %13
+ %17 = OpAccessChain %_ptr_Function_int %x_2_1 %uint_2
+ OpStore %17 %int_30
+ %19 = OpLoad %S %x_2_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.wgsl
new file mode 100644
index 0000000..2af8923
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.wgsl
@@ -0,0 +1,19 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ var x_35 : S;
+ let x_1 : S = x_35;
+ var x_2_1 : S = x_1;
+ x_2_1.field2 = 30;
+ let x_2 : S = x_2_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm
new file mode 100644
index 0000000..3225d09
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%25 = OpConstantNull %mat3v2float
+%_struct_26 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%28 = OpConstantComposite %v2uint %uint_3 %uint_4
+%29 = OpConstantComposite %v2uint %uint_4 %uint_3
+%30 = OpConstantComposite %v2float %float_50 %float_60
+%31 = OpConstantComposite %v2float %float_60 %float_50
+%32 = OpConstantComposite %v2float %float_70 %float_70
+%_arr_mat3v2float_uint_3 = OpTypeArray %mat3v2float %uint_3
+%_struct_34 = OpTypeStruct %uint %_arr_mat3v2float_uint_3
+%_ptr_Function__struct_34 = OpTypePointer Function %_struct_34
+%100 = OpFunction %void None %4
+%36 = OpLabel
+%37 = OpVariable %_ptr_Function__struct_34 Function
+%1 = OpLoad %_struct_34 %37
+%2 = OpCompositeInsert %_struct_34 %float_70 %1 1 2 0 1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..0382970
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+struct S_1 {
+ uint field0;
+ float3x2 field1[3];
+};
+
+void main_1() {
+ S_1 x_37 = (S_1)0;
+ S_1 x_2_1 = x_37;
+ x_2_1.field1[2u][0u].y = 70.0f;
+ const S_1 x_2 = x_2_1;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..3797dc8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.msl
@@ -0,0 +1,30 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+struct tint_array_wrapper {
+ float3x2 arr[3];
+};
+struct S_1 {
+ uint field0;
+ tint_array_wrapper field1;
+};
+
+void main_1() {
+ S_1 x_37 = {};
+ S_1 const x_1 = x_37;
+ S_1 x_2_1 = x_1;
+ x_2_1.field1.arr[2u][0u].y = 70.0f;
+ S_1 const x_2 = x_2_1;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..662e895
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 27
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %S_1 "S_1"
+ OpMemberName %S_1 0 "field0"
+ OpMemberName %S_1 1 "field1"
+ OpName %x_37 "x_37"
+ OpName %x_2_1 "x_2_1"
+ OpName %main "main"
+ OpMemberDecorate %S_1 0 Offset 0
+ OpMemberDecorate %S_1 1 Offset 8
+ OpMemberDecorate %S_1 1 ColMajor
+ OpMemberDecorate %S_1 1 MatrixStride 8
+ OpDecorate %_arr_mat3v2float_uint_3 ArrayStride 24
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+ %uint_3 = OpConstant %uint 3
+%_arr_mat3v2float_uint_3 = OpTypeArray %mat3v2float %uint_3
+ %S_1 = OpTypeStruct %uint %_arr_mat3v2float_uint_3
+%_ptr_Function_S_1 = OpTypePointer Function %S_1
+ %14 = OpConstantNull %S_1
+ %uint_1 = OpConstant %uint 1
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+%_ptr_Function_float = OpTypePointer Function %float
+ %float_70 = OpConstant %float 70
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_37 = OpVariable %_ptr_Function_S_1 Function %14
+ %x_2_1 = OpVariable %_ptr_Function_S_1 Function %14
+ %15 = OpLoad %S_1 %x_37
+ OpStore %x_2_1 %15
+ %21 = OpAccessChain %_ptr_Function_float %x_2_1 %uint_1 %uint_2 %uint_0 %uint_1
+ OpStore %21 %float_70
+ %23 = OpLoad %S_1 %x_2_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..0a25140
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.wgsl
@@ -0,0 +1,24 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+struct S_1 {
+ field0 : u32;
+ field1 : array<mat3x2<f32>, 3>;
+};
+
+fn main_1() {
+ var x_37 : S_1;
+ let x_1 : S_1 = x_37;
+ var x_2_1 : S_1 = x_1;
+ x_2_1.field1[2u][0u].y = 70.0;
+ let x_2 : S_1 = x_2_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm
new file mode 100644
index 0000000..0dcc1e0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm
@@ -0,0 +1,34 @@
+; Test: SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+OpName %var0 "var0"
+OpName %var1 "var1"
+OpMemberName %_struct_7 0 "algo"
+OpMemberName %_struct_8 0 "rithm"
+%void = OpTypeVoid
+%10 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%uint_10 = OpConstant %uint 10
+%uint_11 = OpConstant %uint 11
+%_struct_7 = OpTypeStruct %uint
+%_struct_8 = OpTypeStruct %uint
+%_ptr_Function__struct_7 = OpTypePointer Function %_struct_7
+%_ptr_Function__struct_8 = OpTypePointer Function %_struct_8
+%100 = OpFunction %void None %10
+%16 = OpLabel
+%var0 = OpVariable %_ptr_Function__struct_7 Function
+%var1 = OpVariable %_ptr_Function__struct_8 Function
+%1 = OpLoad %_struct_7 %var0
+%2 = OpCompositeInsert %_struct_7 %uint_10 %1 0
+%3 = OpLoad %_struct_8 %var1
+%4 = OpCompositeInsert %_struct_8 %uint_11 %3 0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.hlsl
new file mode 100644
index 0000000..e55fd97
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.hlsl
@@ -0,0 +1,23 @@
+struct S {
+ uint algo;
+};
+struct S_1 {
+ uint rithm;
+};
+
+void main_1() {
+ S var0 = (S)0;
+ S_1 var1 = (S_1)0;
+ S x_2_1 = var0;
+ x_2_1.algo = 10u;
+ const S x_2 = x_2_1;
+ S_1 x_4_1 = var1;
+ x_4_1.rithm = 11u;
+ const S_1 x_4 = x_4_1;
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.msl
new file mode 100644
index 0000000..2b3fd60
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.msl
@@ -0,0 +1,29 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ uint algo;
+};
+struct S_1 {
+ uint rithm;
+};
+
+void main_1() {
+ S var0 = {};
+ S_1 var1 = {};
+ S const x_1 = var0;
+ S x_2_1 = x_1;
+ x_2_1.algo = 10u;
+ S const x_2 = x_2_1;
+ S_1 const x_3 = var1;
+ S_1 x_4_1 = x_3;
+ x_4_1.rithm = 11u;
+ S_1 const x_4 = x_4_1;
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.spvasm
new file mode 100644
index 0000000..f611976
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %S "S"
+ OpMemberName %S 0 "algo"
+ OpName %var0 "var0"
+ OpName %S_1 "S_1"
+ OpMemberName %S_1 0 "rithm"
+ OpName %var1 "var1"
+ OpName %x_2_1 "x_2_1"
+ OpName %x_4_1 "x_4_1"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S_1 0 Offset 0
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %S = OpTypeStruct %uint
+%_ptr_Function_S = OpTypePointer Function %S
+ %9 = OpConstantNull %S
+ %S_1 = OpTypeStruct %uint
+%_ptr_Function_S_1 = OpTypePointer Function %S_1
+ %13 = OpConstantNull %S_1
+ %uint_0 = OpConstant %uint 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %uint_10 = OpConstant %uint 10
+ %uint_11 = OpConstant %uint 11
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %var0 = OpVariable %_ptr_Function_S Function %9
+ %var1 = OpVariable %_ptr_Function_S_1 Function %13
+ %x_2_1 = OpVariable %_ptr_Function_S Function %9
+ %x_4_1 = OpVariable %_ptr_Function_S_1 Function %13
+ %14 = OpLoad %S %var0
+ OpStore %x_2_1 %14
+ %18 = OpAccessChain %_ptr_Function_uint %x_2_1 %uint_0
+ OpStore %18 %uint_10
+ %20 = OpLoad %S %x_2_1
+ %21 = OpLoad %S_1 %var1
+ OpStore %x_4_1 %21
+ %23 = OpAccessChain %_ptr_Function_uint %x_4_1 %uint_0
+ OpStore %23 %uint_11
+ %25 = OpLoad %S_1 %x_4_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.wgsl
new file mode 100644
index 0000000..ba2ae45
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.wgsl
@@ -0,0 +1,26 @@
+struct S {
+ algo : u32;
+};
+
+struct S_1 {
+ rithm : u32;
+};
+
+fn main_1() {
+ var var0 : S;
+ var var1 : S_1;
+ let x_1 : S = var0;
+ var x_2_1 : S = x_1;
+ x_2_1.algo = 10u;
+ let x_2 : S = x_2_1;
+ let x_3 : S_1 = var1;
+ var x_4_1 : S_1 = x_3;
+ x_4_1.rithm = 11u;
+ let x_4 : S_1 = x_4_1;
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm
new file mode 100644
index 0000000..4eb0b2c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserTest_CompositeInsert_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%24 = OpConstantNull %mat3v2float
+%_struct_25 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%27 = OpConstantComposite %v2uint %uint_3 %uint_4
+%28 = OpConstantComposite %v2uint %uint_4 %uint_3
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%31 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %3
+%32 = OpLabel
+%1 = OpCompositeInsert %v2float %float_70 %29 1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..7f31544
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void main_1() {
+ float2 x_1_1 = float2(50.0f, 60.0f);
+ x_1_1.y = 70.0f;
+ const float2 x_1 = x_1_1;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..8e3912a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ float2 x_1_1 = float2(50.0f, 60.0f);
+ x_1_1.y = 70.0f;
+ float2 const x_1 = x_1_1;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..4a130b6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.spvasm
@@ -0,0 +1,39 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %x_1_1 "x_1_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %12 = OpConstantNull %v2float
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %float_70 = OpConstant %float 70
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_1_1 = OpVariable %_ptr_Function_v2float Function %12
+ OpStore %x_1_1 %9
+ %16 = OpAccessChain %_ptr_Function_float %x_1_1 %uint_1
+ OpStore %16 %float_70
+ %18 = OpLoad %v2float %x_1_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..14d6304
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ var x_1_1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ x_1_1.y = 70.0;
+ let x_1 : vec2<f32> = x_1_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm
new file mode 100644
index 0000000..dd3711d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserTest_Composite_Construct_Array.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%24 = OpConstantNull %mat3v2float
+%_struct_25 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%27 = OpConstantComposite %v2uint %uint_3 %uint_4
+%28 = OpConstantComposite %v2uint %uint_4 %uint_3
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%31 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %3
+%32 = OpLabel
+%1 = OpCompositeConstruct %_arr_uint_uint_5 %uint_10 %uint_20 %uint_3 %uint_4 %uint_5
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.hlsl
new file mode 100644
index 0000000..7d783ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const uint x_1[5] = {10u, 20u, 3u, 4u, 5u};
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.msl
new file mode 100644
index 0000000..8d4e43f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+struct tint_array_wrapper {
+ uint arr[5];
+};
+
+void main_1() {
+ tint_array_wrapper const x_1 = {.arr={10u, 20u, 3u, 4u, 5u}};
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.spvasm
new file mode 100644
index 0000000..6d4b90f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ OpDecorate %_arr_uint_uint_5 ArrayStride 4
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_5 = OpConstant %uint 5
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %12 = OpConstantComposite %_arr_uint_uint_5 %uint_10 %uint_20 %uint_3 %uint_4 %uint_5
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.wgsl
new file mode 100644
index 0000000..05ed420
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ let x_1 : array<u32, 5> = array<u32, 5>(10u, 20u, 3u, 4u, 5u);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm
new file mode 100644
index 0000000..02d7f3d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserTest_Composite_Construct_Matrix.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%24 = OpConstantNull %mat3v2float
+%_struct_25 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%27 = OpConstantComposite %v2uint %uint_3 %uint_4
+%28 = OpConstantComposite %v2uint %uint_4 %uint_3
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%31 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %3
+%32 = OpLabel
+%1 = OpCompositeConstruct %mat3v2float %29 %30 %31
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.hlsl
new file mode 100644
index 0000000..08b4743
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float3x2 x_1 = float3x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f), float2(70.0f, 70.0f));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.msl
new file mode 100644
index 0000000..099ab71
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ float3x2 const x_1 = float3x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f), float2(70.0f, 70.0f));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.spvasm
new file mode 100644
index 0000000..a6199c2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %float_70 = OpConstant %float 70
+ %13 = OpConstantComposite %v2float %float_70 %float_70
+ %14 = OpConstantComposite %mat3v2float %10 %11 %13
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.wgsl
new file mode 100644
index 0000000..0bb8da5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ let x_1 : mat3x2<f32> = mat3x2<f32>(vec2<f32>(50.0, 60.0), vec2<f32>(60.0, 50.0), vec2<f32>(70.0, 70.0));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm
new file mode 100644
index 0000000..232467c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserTest_Composite_Construct_Struct.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%24 = OpConstantNull %mat3v2float
+%_struct_25 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%27 = OpConstantComposite %v2uint %uint_3 %uint_4
+%28 = OpConstantComposite %v2uint %uint_4 %uint_3
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%31 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %3
+%32 = OpLabel
+%1 = OpCompositeConstruct %_struct_25 %29 %uint_5 %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.hlsl
new file mode 100644
index 0000000..5fe220c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ const S x_1 = {float2(50.0f, 60.0f), 5u, 30};
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.msl
new file mode 100644
index 0000000..80d8ce6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ S const x_1 = {.field0=float2(50.0f, 60.0f), .field1=5u, .field2=30};
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.spvasm
new file mode 100644
index 0000000..4a65d40
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.spvasm
@@ -0,0 +1,40 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %S "S"
+ OpMemberName %S 0 "field0"
+ OpMemberName %S 1 "field1"
+ OpMemberName %S 2 "field2"
+ OpName %main "main"
+ OpMemberDecorate %S 0 Offset 0
+ OpMemberDecorate %S 1 Offset 8
+ OpMemberDecorate %S 2 Offset 12
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %S = OpTypeStruct %v2float %uint %int
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %12 = OpConstantComposite %v2float %float_50 %float_60
+ %uint_5 = OpConstant %uint 5
+ %int_30 = OpConstant %int 30
+ %15 = OpConstantComposite %S %12 %uint_5 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.wgsl
new file mode 100644
index 0000000..4b35253
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ let x_1 : S = S(vec2<f32>(50.0, 60.0), 5u, 30);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm
new file mode 100644
index 0000000..a86377a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvParserTest_Composite_Construct_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%26 = OpConstantNull %mat3v2float
+%_struct_27 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%29 = OpConstantComposite %v2uint %uint_3 %uint_4
+%30 = OpConstantComposite %v2uint %uint_4 %uint_3
+%31 = OpConstantComposite %v2float %float_50 %float_60
+%32 = OpConstantComposite %v2float %float_60 %float_50
+%33 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %5
+%34 = OpLabel
+%1 = OpCompositeConstruct %v2uint %uint_10 %uint_20
+%2 = OpCompositeConstruct %v2int %int_30 %int_40
+%3 = OpCompositeConstruct %v2float %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..d64f138
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void main_1() {
+ const uint2 x_1 = uint2(10u, 20u);
+ const int2 x_2 = int2(30, 40);
+ const float2 x_3 = float2(50.0f, 60.0f);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..381608f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ uint2 const x_1 = uint2(10u, 20u);
+ int2 const x_2 = int2(30, 40);
+ float2 const x_3 = float2(50.0f, 60.0f);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..16c2568
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 23
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %19 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..57e2e22
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ let x_1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let x_2 : vec2<i32> = vec2<i32>(30, 40);
+ let x_3 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm
new file mode 100644
index 0000000..b77bf99
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm
@@ -0,0 +1,20 @@
+; Test: SpvParserTest_ConvertType_Array.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 11
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%uint = OpTypeInt 32 0
+%uint_42 = OpConstant %uint 42
+%_arr_uint_uint_42 = OpTypeArray %uint %uint_42
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm
new file mode 100644
index 0000000..fa5d0a5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvParserTest_ConvertType_ArrayStride_Valid.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 11
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %_arr_uint_uint_5 ArrayStride 8
+%uint = OpTypeInt 32 0
+%uint_5 = OpConstant %uint 5
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.msl
new file mode 100644
index 0000000..29e48c8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_padded_array_element {
+ uint el;
+};
+struct tint_array_wrapper {
+ tint_padded_array_element arr[5];
+};
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.wgsl
new file mode 100644
index 0000000..832c058
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+type Arr = [[stride(8)]] array<u32, 5>;
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm
new file mode 100644
index 0000000..f7c611a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm
@@ -0,0 +1,18 @@
+; Test: SpvParserTest_ConvertType_Bool.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%bool = OpTypeBool
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%1 = OpFunction %void None %3
+%4 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm
new file mode 100644
index 0000000..e480e17
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm
@@ -0,0 +1,18 @@
+; Test: SpvParserTest_ConvertType_F32.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 6
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%1 = OpFunction %void None %3
+%5 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm
new file mode 100644
index 0000000..098d706
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm
@@ -0,0 +1,18 @@
+; Test: SpvParserTest_ConvertType_I32.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 6
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%int = OpTypeInt 32 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%1 = OpFunction %void None %4
+%5 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm
new file mode 100644
index 0000000..26bdfbf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_ConvertType_Image_PretendVoid.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "x_100"
+OpExecutionMode %2 OriginUpperLeft
+%float = OpTypeFloat 32
+%1 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%2 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm
new file mode 100644
index 0000000..7993591
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm
@@ -0,0 +1,30 @@
+; Test: SpvParserTest_ConvertType_MatrixOverF32.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 45
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%mat4v2float = OpTypeMatrix %v2float 4
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v3float = OpTypeMatrix %v3float 3
+%mat4v3float = OpTypeMatrix %v3float 4
+%mat2v4float = OpTypeMatrix %v4float 2
+%mat3v4float = OpTypeMatrix %v4float 3
+%mat4v4float = OpTypeMatrix %v4float 4
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%1 = OpFunction %void None %7
+%8 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm
new file mode 100644
index 0000000..cdd4c16
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_ConvertType_PointerFunction.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%_ptr_Function_float = OpTypePointer Function %float
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm
new file mode 100644
index 0000000..5acd6ed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_ConvertType_PointerImage.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%_ptr_Image_float = OpTypePointer Image %float
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm
new file mode 100644
index 0000000..e37d18e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_ConvertType_PointerInput.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%_ptr_Input_float = OpTypePointer Input %float
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm
new file mode 100644
index 0000000..5df1c30
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_ConvertType_PointerOutput.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm
new file mode 100644
index 0000000..410668f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_ConvertType_PointerPrivate.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%_ptr_Private_float = OpTypePointer Private %float
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm
new file mode 100644
index 0000000..6a2e803
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_ConvertType_PointerStorageBuffer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm
new file mode 100644
index 0000000..1befa0a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm
@@ -0,0 +1,20 @@
+; Test: SpvParserTest_ConvertType_PointerToPointer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 43
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+%_ptr_Input__ptr_Output_float = OpTypePointer Input %_ptr_Output_float
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm
new file mode 100644
index 0000000..d6d8399
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_ConvertType_PointerUniform.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%_ptr_Uniform_float = OpTypePointer Uniform %float
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm
new file mode 100644
index 0000000..436fe79
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_ConvertType_PointerUniformConstant.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%_ptr_UniformConstant_float = OpTypePointer UniformConstant %float
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm
new file mode 100644
index 0000000..6eca049
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_ConvertType_PointerWorkgroup.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 7
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%_ptr_Workgroup_float = OpTypePointer Workgroup %float
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm
new file mode 100644
index 0000000..8739662
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_ConvertType_RuntimeArray.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 11
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%uint = OpTypeInt 32 0
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%1 = OpFunction %void None %4
+%5 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.msl
new file mode 100644
index 0000000..f139cc3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.wgsl
new file mode 100644
index 0000000..2fa51ee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+type RTArr = array<u32>;
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm
new file mode 100644
index 0000000..7254d4e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm
@@ -0,0 +1,20 @@
+; Test: SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 11
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %_runtimearr_uint ArrayStride 64
+%uint = OpTypeInt 32 0
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%1 = OpFunction %void None %4
+%5 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.msl
new file mode 100644
index 0000000..35ec4e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_padded_array_element {
+ uint el;
+};
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.wgsl
new file mode 100644
index 0000000..33ecaf5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+type RTArr = [[stride(64)]] array<u32>;
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm
new file mode 100644
index 0000000..7afe986
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm
@@ -0,0 +1,20 @@
+; Test: SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 8
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "x_100"
+OpExecutionMode %2 OriginUpperLeft
+%float = OpTypeFloat 32
+%4 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%1 = OpTypeSampledImage %4
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%2 = OpFunction %void None %6
+%7 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm
new file mode 100644
index 0000000..6031169
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm
@@ -0,0 +1,18 @@
+; Test: SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 6
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "x_100"
+OpExecutionMode %2 OriginUpperLeft
+%1 = OpTypeSampler
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%2 = OpFunction %void None %4
+%5 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm
new file mode 100644
index 0000000..a0f3e8e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm
@@ -0,0 +1,20 @@
+; Test: SpvParserTest_ConvertType_StructTwoMembers.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 11
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%uint = OpTypeInt 32 0
+%float = OpTypeFloat 32
+%_struct_10 = OpTypeStruct %uint %float
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%1 = OpFunction %void None %5
+%6 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.msl
new file mode 100644
index 0000000..5658b79
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ uint field0;
+ float field1;
+};
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.wgsl
new file mode 100644
index 0000000..9e865ed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+struct S {
+ field0 : u32;
+ field1 : f32;
+};
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm
new file mode 100644
index 0000000..3ffa7a5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm
@@ -0,0 +1,20 @@
+; Test: SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 11
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+OpDecorate %_struct_10 Block
+%uint = OpTypeInt 32 0
+%_struct_10 = OpTypeStruct %uint
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%1 = OpFunction %void None %4
+%5 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.msl
new file mode 100644
index 0000000..f8e95d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ uint field0;
+};
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.wgsl
new file mode 100644
index 0000000..a7f1f27
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+struct S {
+ field0 : u32;
+};
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm
new file mode 100644
index 0000000..6a86cd0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm
@@ -0,0 +1,24 @@
+; Test: SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 11
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+OpMemberDecorate %_struct_10 0 Offset 0
+OpMemberDecorate %_struct_10 1 Offset 8
+OpMemberDecorate %_struct_10 2 Offset 16
+%float = OpTypeFloat 32
+%v2float = OpTypeVector %float 2
+%mat2v2float = OpTypeMatrix %v2float 2
+%_struct_10 = OpTypeStruct %float %v2float %mat2v2float
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%1 = OpFunction %void None %6
+%7 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.msl
new file mode 100644
index 0000000..1d13c86
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.msl
@@ -0,0 +1,18 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float field0;
+ float2 field1;
+ float2x2 field2;
+};
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.wgsl
new file mode 100644
index 0000000..67729f3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+struct S {
+ field0 : f32;
+ [[size(4)]]
+ padding : u32;
+ field1 : vec2<f32>;
+ field2 : mat2x2<f32>;
+};
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm
new file mode 100644
index 0000000..f732eac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm
@@ -0,0 +1,18 @@
+; Test: SpvParserTest_ConvertType_U32.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 6
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%uint = OpTypeInt 32 0
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%1 = OpFunction %void None %4
+%5 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm
new file mode 100644
index 0000000..32ffb4d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvParserTest_ConvertType_VecOverF32.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 41
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%float = OpTypeFloat 32
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%1 = OpFunction %void None %4
+%5 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm
new file mode 100644
index 0000000..710952c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvParserTest_ConvertType_VecOverI32.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 41
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%int = OpTypeInt 32 1
+%v2int = OpTypeVector %int 2
+%v3int = OpTypeVector %int 3
+%v4int = OpTypeVector %int 4
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%1 = OpFunction %void None %4
+%5 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm
new file mode 100644
index 0000000..80c33b1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvParserTest_ConvertType_VecOverU32.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 41
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+%uint = OpTypeInt 32 0
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%1 = OpFunction %void None %4
+%5 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm
new file mode 100644
index 0000000..159e98e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm
@@ -0,0 +1,17 @@
+; Test: SpvParserTest_ConvertType_Void.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 5
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %2 "x_100"
+OpExecutionMode %2 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%2 = OpFunction %void None %3
+%4 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm
new file mode 100644
index 0000000..7974f2a6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserTest_CopyObject_Pointer.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%26 = OpConstantNull %mat3v2float
+%_struct_27 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%29 = OpConstantComposite %v2uint %uint_3 %uint_4
+%30 = OpConstantComposite %v2uint %uint_4 %uint_3
+%31 = OpConstantComposite %v2float %float_50 %float_60
+%32 = OpConstantComposite %v2float %float_60 %float_50
+%33 = OpConstantComposite %v2float %float_70 %float_70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%100 = OpFunction %void None %4
+%35 = OpLabel
+%10 = OpVariable %_ptr_Function_uint Function
+%1 = OpCopyObject %_ptr_Function_uint %10
+%2 = OpCopyObject %_ptr_Function_uint %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.hlsl
new file mode 100644
index 0000000..0bc2907
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ uint x_10 = 0u;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.msl
new file mode 100644
index 0000000..63dd04c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ uint x_10 = 0u;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.spvasm
new file mode 100644
index 0000000..bf3b294
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %x_10 "x_10"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %8 = OpConstantNull %uint
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_10 = OpVariable %_ptr_Function_uint Function %8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.wgsl
new file mode 100644
index 0000000..b4520cb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ var x_10 : u32;
+ let x_1 : ptr<function, u32> = &(x_10);
+ let x_2 : ptr<function, u32> = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm
new file mode 100644
index 0000000..d47e376
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm
@@ -0,0 +1,47 @@
+; Test: SpvParserTest_CopyObject_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%25 = OpConstantNull %mat3v2float
+%_struct_26 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%28 = OpConstantComposite %v2uint %uint_3 %uint_4
+%29 = OpConstantComposite %v2uint %uint_4 %uint_3
+%30 = OpConstantComposite %v2float %float_50 %float_60
+%31 = OpConstantComposite %v2float %float_60 %float_50
+%32 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %4
+%33 = OpLabel
+%1 = OpCopyObject %uint %uint_3
+%2 = OpCopyObject %uint %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..c46879a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const uint x_2 = 3u;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..ba9d691
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ uint const x_1 = 3u;
+ uint const x_2 = x_1;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..b547a71
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,24 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 10
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_3 = OpConstant %uint 3
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %8 = OpLabel
+ %9 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..bb59772
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ let x_1 : u32 = 3u;
+ let x_2 : u32 = x_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm
new file mode 100644
index 0000000..664bd69
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm
@@ -0,0 +1,41 @@
+; Test: SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 18
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+OpName %root "root"
+OpName %branch "branch"
+OpName %leaf "leaf"
+OpName %leaf_result "leaf_result"
+OpName %branch_result "branch_result"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%12 = OpTypeFunction %uint
+%uint_0 = OpConstant %uint 0
+%root = OpFunction %void None %8
+%14 = OpLabel
+%branch_result = OpFunctionCall %uint %branch
+OpReturn
+OpFunctionEnd
+%branch = OpFunction %uint None %12
+%15 = OpLabel
+%leaf_result = OpFunctionCall %uint %leaf
+OpReturnValue %leaf_result
+OpFunctionEnd
+%leaf = OpFunction %uint None %12
+%16 = OpLabel
+OpReturnValue %uint_0
+OpFunctionEnd
+%1 = OpFunction %void None %8
+%17 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.hlsl
new file mode 100644
index 0000000..f8a784a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.hlsl
@@ -0,0 +1,22 @@
+uint leaf() {
+ return 0u;
+}
+
+uint tint_symbol() {
+ const uint leaf_result = leaf();
+ return leaf_result;
+}
+
+void root() {
+ const uint branch_result = tint_symbol();
+ return;
+}
+
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.msl
new file mode 100644
index 0000000..305f1f9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.msl
@@ -0,0 +1,26 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint leaf() {
+ return 0u;
+}
+
+uint branch() {
+ uint const leaf_result = leaf();
+ return leaf_result;
+}
+
+void root() {
+ uint const branch_result = branch();
+ return;
+}
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.spvasm
new file mode 100644
index 0000000..0abd155
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %leaf "leaf"
+ OpName %branch "branch"
+ OpName %root "root"
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %uint = OpTypeInt 32 0
+ %1 = OpTypeFunction %uint
+ %uint_0 = OpConstant %uint 0
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %leaf = OpFunction %uint None %1
+ %4 = OpLabel
+ OpReturnValue %uint_0
+ OpFunctionEnd
+ %branch = OpFunction %uint None %1
+ %7 = OpLabel
+ %8 = OpFunctionCall %uint %leaf
+ OpReturnValue %8
+ OpFunctionEnd
+ %root = OpFunction %void None %9
+ %12 = OpLabel
+ %13 = OpFunctionCall %uint %branch
+ OpReturn
+ OpFunctionEnd
+ %x_100_1 = OpFunction %void None %9
+ %15 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %9
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.wgsl
new file mode 100644
index 0000000..2812801
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+fn leaf() -> u32 {
+ return 0u;
+}
+
+fn branch() -> u32 {
+ let leaf_result : u32 = leaf();
+ return leaf_result;
+}
+
+fn root() {
+ let branch_result : u32 = branch();
+ return;
+}
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm
new file mode 100644
index 0000000..29a51e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 8
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %main "main"
+OpExecutionMode %main OriginUpperLeft
+OpName %main "main"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%main = OpFunction %void None %3
+%7 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.hlsl
new file mode 100644
index 0000000..1135368
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.spvasm
new file mode 100644
index 0000000..ca944f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.wgsl
new file mode 100644
index 0000000..471e2a6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm
new file mode 100644
index 0000000..4038b24
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 8
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %main "main"
+OpExecutionMode %main LocalSize 1 1 1
+OpName %main "main"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%main = OpFunction %void None %3
+%7 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.hlsl
new file mode 100644
index 0000000..7d04ef1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.msl
new file mode 100644
index 0000000..1de7f83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.spvasm
new file mode 100644
index 0000000..0114d7e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.wgsl
new file mode 100644
index 0000000..05ff825
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm
new file mode 100644
index 0000000..a10ab48
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 8
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %main "comp_main"
+OpExecutionMode %main LocalSize 2 4 8
+OpName %main "main"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%main = OpFunction %void None %3
+%7 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.hlsl
new file mode 100644
index 0000000..5166e1b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void comp_main_1() {
+ return;
+}
+
+[numthreads(2, 4, 8)]
+void comp_main() {
+ comp_main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.msl
new file mode 100644
index 0000000..13e6b61
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void comp_main_1() {
+ return;
+}
+
+kernel void comp_main() {
+ comp_main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.spvasm
new file mode 100644
index 0000000..498c258
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %comp_main "comp_main"
+ OpExecutionMode %comp_main LocalSize 2 4 8
+ OpName %comp_main_1 "comp_main_1"
+ OpName %comp_main "comp_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+%comp_main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %comp_main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %comp_main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.wgsl
new file mode 100644
index 0000000..605ba35
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn comp_main_1() {
+ return;
+}
+
+[[stage(compute), workgroup_size(2, 4, 8)]]
+fn comp_main() {
+ comp_main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm
new file mode 100644
index 0000000..5ffad5d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %1 "comp_main"
+OpExecutionMode %1 LocalSize 2 4 8
+OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
+OpDecorate %3 SpecId 0
+OpDecorate %4 SpecId 1
+OpDecorate %5 SpecId 2
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%3 = OpSpecConstant %uint 3
+%4 = OpSpecConstant %uint 5
+%5 = OpSpecConstant %uint 7
+%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %3 %4 %5
+%1 = OpFunction %void None %7
+%12 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.hlsl
new file mode 100644
index 0000000..c73a243
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.hlsl
@@ -0,0 +1,22 @@
+#ifndef WGSL_SPEC_CONSTANT_0
+#define WGSL_SPEC_CONSTANT_0 3u
+#endif
+static const uint x_3 = WGSL_SPEC_CONSTANT_0;
+#ifndef WGSL_SPEC_CONSTANT_1
+#define WGSL_SPEC_CONSTANT_1 5u
+#endif
+static const uint x_4 = WGSL_SPEC_CONSTANT_1;
+#ifndef WGSL_SPEC_CONSTANT_2
+#define WGSL_SPEC_CONSTANT_2 7u
+#endif
+static const uint x_5 = WGSL_SPEC_CONSTANT_2;
+
+void comp_main_1() {
+ return;
+}
+
+[numthreads(3, 5, 7)]
+void comp_main() {
+ comp_main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.msl
new file mode 100644
index 0000000..818f216
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant uint x_3 [[function_constant(0)]];
+constant uint x_4 [[function_constant(1)]];
+constant uint x_5 [[function_constant(2)]];
+void comp_main_1() {
+ return;
+}
+
+kernel void comp_main() {
+ comp_main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.spvasm
new file mode 100644
index 0000000..d0987b2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %comp_main "comp_main"
+ OpExecutionMode %comp_main LocalSize 3 5 7
+ OpName %x_3 "x_3"
+ OpName %x_4 "x_4"
+ OpName %x_5 "x_5"
+ OpName %comp_main_1 "comp_main_1"
+ OpName %comp_main "comp_main"
+ OpDecorate %x_3 SpecId 0
+ OpDecorate %x_4 SpecId 1
+ OpDecorate %x_5 SpecId 2
+ %uint = OpTypeInt 32 0
+ %x_3 = OpSpecConstant %uint 3
+ %x_4 = OpSpecConstant %uint 5
+ %x_5 = OpSpecConstant %uint 7
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+%comp_main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %comp_main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %comp_main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.wgsl
new file mode 100644
index 0000000..32cb805
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.wgsl
@@ -0,0 +1,14 @@
+[[override(0)]] let x_3 : u32 = 3u;
+
+[[override(1)]] let x_4 : u32 = 5u;
+
+[[override(2)]] let x_5 : u32 = 7u;
+
+fn comp_main_1() {
+ return;
+}
+
+[[stage(compute), workgroup_size(3, 5, 7)]]
+fn comp_main() {
+ comp_main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm
new file mode 100644
index 0000000..9837add
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm
@@ -0,0 +1,22 @@
+; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 8
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %main "first_shader"
+OpEntryPoint Fragment %main "second_shader"
+OpExecutionMode %main OriginUpperLeft
+OpName %main "main"
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%main = OpFunction %void None %3
+%7 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.hlsl
new file mode 100644
index 0000000..6d1d064
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+void first_shader_1() {
+ return;
+}
+
+void first_shader() {
+ first_shader_1();
+ return;
+}
+
+void second_shader() {
+ first_shader_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.msl
new file mode 100644
index 0000000..c26e2c7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void first_shader_1() {
+ return;
+}
+
+fragment void first_shader() {
+ first_shader_1();
+ return;
+}
+
+fragment void second_shader() {
+ first_shader_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.spvasm
new file mode 100644
index 0000000..74b91bf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %first_shader "first_shader"
+ OpEntryPoint Fragment %second_shader "second_shader"
+ OpExecutionMode %first_shader OriginUpperLeft
+ OpExecutionMode %second_shader OriginUpperLeft
+ OpName %first_shader_1 "first_shader_1"
+ OpName %first_shader "first_shader"
+ OpName %second_shader "second_shader"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+%first_shader_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%first_shader = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %first_shader_1
+ OpReturn
+ OpFunctionEnd
+%second_shader = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %first_shader_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.wgsl
new file mode 100644
index 0000000..20b0a60
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn first_shader_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn first_shader() {
+ first_shader_1();
+}
+
+[[stage(fragment)]]
+fn second_shader() {
+ first_shader_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm
new file mode 100644
index 0000000..946d2d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm
@@ -0,0 +1,24 @@
+; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 11
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Vertex %main "main" %gl_Position
+OpName %main "main"
+OpDecorate %gl_Position BuiltIn Position
+%float = OpTypeFloat 32
+%v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%gl_Position = OpVariable %_ptr_Output_v4float Output
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%main = OpFunction %void None %7
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.hlsl
new file mode 100644
index 0000000..1993bce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+static float4 x_2 = float4(0.0f, 0.0f, 0.0f, 0.0f);
+
+void main_1() {
+ return;
+}
+
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol {
+ float4 x_2_1 : SV_Position;
+};
+
+tint_symbol main() {
+ main_1();
+ const main_out tint_symbol_1 = {x_2};
+ const tint_symbol tint_symbol_2 = {tint_symbol_1.x_2_1};
+ return tint_symbol_2;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.msl
new file mode 100644
index 0000000..31d7145
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct main_out {
+ float4 x_2_1;
+};
+struct tint_symbol_1 {
+ float4 x_2_1 [[position]];
+};
+
+void main_1() {
+ return;
+}
+
+vertex tint_symbol_1 tint_symbol() {
+ thread float4 tint_symbol_4 = 0.0f;
+ main_1();
+ main_out const tint_symbol_2 = {.x_2_1=tint_symbol_4};
+ tint_symbol_1 const tint_symbol_3 = {.x_2_1=tint_symbol_2.x_2_1};
+ return tint_symbol_3;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.spvasm
new file mode 100644
index 0000000..8c45878
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol_1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %x_2 "x_2"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %main_1 "main_1"
+ OpName %main_out "main_out"
+ OpMemberName %main_out 0 "x_2_1"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %main "main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ OpMemberDecorate %main_out 0 Offset 0
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %v4float = OpTypeVector %float 4
+%_ptr_Private_v4float = OpTypePointer Private %v4float
+ %8 = OpConstantNull %v4float
+ %x_2 = OpVariable %_ptr_Private_v4float Private %8
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %8
+ %void = OpTypeVoid
+ %11 = OpTypeFunction %void
+ %main_out = OpTypeStruct %v4float
+ %15 = OpTypeFunction %void %main_out
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %11
+ %14 = OpLabel
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %15
+%tint_symbol = OpFunctionParameter %main_out
+ %19 = OpLabel
+ %20 = OpCompositeExtract %v4float %tint_symbol 0
+ OpStore %tint_symbol_1 %20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %11
+ %22 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %24 = OpFunctionCall %void %main_1
+ %26 = OpLoad %v4float %x_2
+ %27 = OpCompositeConstruct %main_out %26
+ %25 = OpFunctionCall %void %tint_symbol_2 %27
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.wgsl
new file mode 100644
index 0000000..7f989e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+var<private> x_2 : vec4<f32>;
+
+fn main_1() {
+ return;
+}
+
+struct main_out {
+ [[builtin(position)]]
+ x_2_1 : vec4<f32>;
+};
+
+[[stage(vertex)]]
+fn main() -> main_out {
+ main_1();
+ return main_out(x_2);
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm
new file mode 100644
index 0000000..aea0060
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm
@@ -0,0 +1,25 @@
+; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %1 "comp_main"
+OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%uint_3 = OpConstant %uint 3
+%uint_5 = OpConstant %uint 5
+%uint_7 = OpConstant %uint 7
+%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_3 %uint_5 %uint_7
+%1 = OpFunction %void None %4
+%12 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.hlsl
new file mode 100644
index 0000000..4450285
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void comp_main_1() {
+ return;
+}
+
+[numthreads(3, 5, 7)]
+void comp_main() {
+ comp_main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.msl
new file mode 100644
index 0000000..13e6b61
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void comp_main_1() {
+ return;
+}
+
+kernel void comp_main() {
+ comp_main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.spvasm
new file mode 100644
index 0000000..16f8d91
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %comp_main "comp_main"
+ OpExecutionMode %comp_main LocalSize 3 5 7
+ OpName %comp_main_1 "comp_main_1"
+ OpName %comp_main "comp_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+%comp_main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %comp_main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %comp_main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.wgsl
new file mode 100644
index 0000000..7fba773
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn comp_main_1() {
+ return;
+}
+
+[[stage(compute), workgroup_size(3, 5, 7)]]
+fn comp_main() {
+ comp_main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm
new file mode 100644
index 0000000..839812e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm
@@ -0,0 +1,28 @@
+; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %1 "comp_main"
+OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
+OpDecorate %3 SpecId 0
+OpDecorate %4 SpecId 1
+OpDecorate %5 SpecId 2
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%3 = OpSpecConstant %uint 3
+%4 = OpSpecConstant %uint 5
+%5 = OpSpecConstant %uint 7
+%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %3 %4 %5
+%1 = OpFunction %void None %7
+%12 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.hlsl
new file mode 100644
index 0000000..c73a243
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.hlsl
@@ -0,0 +1,22 @@
+#ifndef WGSL_SPEC_CONSTANT_0
+#define WGSL_SPEC_CONSTANT_0 3u
+#endif
+static const uint x_3 = WGSL_SPEC_CONSTANT_0;
+#ifndef WGSL_SPEC_CONSTANT_1
+#define WGSL_SPEC_CONSTANT_1 5u
+#endif
+static const uint x_4 = WGSL_SPEC_CONSTANT_1;
+#ifndef WGSL_SPEC_CONSTANT_2
+#define WGSL_SPEC_CONSTANT_2 7u
+#endif
+static const uint x_5 = WGSL_SPEC_CONSTANT_2;
+
+void comp_main_1() {
+ return;
+}
+
+[numthreads(3, 5, 7)]
+void comp_main() {
+ comp_main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.msl
new file mode 100644
index 0000000..818f216
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant uint x_3 [[function_constant(0)]];
+constant uint x_4 [[function_constant(1)]];
+constant uint x_5 [[function_constant(2)]];
+void comp_main_1() {
+ return;
+}
+
+kernel void comp_main() {
+ comp_main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.spvasm
new file mode 100644
index 0000000..d0987b2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %comp_main "comp_main"
+ OpExecutionMode %comp_main LocalSize 3 5 7
+ OpName %x_3 "x_3"
+ OpName %x_4 "x_4"
+ OpName %x_5 "x_5"
+ OpName %comp_main_1 "comp_main_1"
+ OpName %comp_main "comp_main"
+ OpDecorate %x_3 SpecId 0
+ OpDecorate %x_4 SpecId 1
+ OpDecorate %x_5 SpecId 2
+ %uint = OpTypeInt 32 0
+ %x_3 = OpSpecConstant %uint 3
+ %x_4 = OpSpecConstant %uint 5
+ %x_5 = OpSpecConstant %uint 7
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+%comp_main_1 = OpFunction %void None %5
+ %8 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %comp_main = OpFunction %void None %5
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %comp_main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.wgsl
new file mode 100644
index 0000000..32cb805
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.wgsl
@@ -0,0 +1,14 @@
+[[override(0)]] let x_3 : u32 = 3u;
+
+[[override(1)]] let x_4 : u32 = 5u;
+
+[[override(2)]] let x_5 : u32 = 7u;
+
+fn comp_main_1() {
+ return;
+}
+
+[[stage(compute), workgroup_size(3, 5, 7)]]
+fn comp_main() {
+ comp_main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm
new file mode 100644
index 0000000..0c89e6b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm
@@ -0,0 +1,27 @@
+; Test: SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 13
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %1 "comp_main"
+OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
+OpDecorate %3 SpecId 0
+OpDecorate %4 SpecId 2
+%void = OpTypeVoid
+%6 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%v3uint = OpTypeVector %uint 3
+%3 = OpSpecConstant %uint 3
+%uint_5 = OpConstant %uint 5
+%4 = OpSpecConstant %uint 7
+%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %3 %uint_5 %4
+%1 = OpFunction %void None %6
+%12 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.hlsl
new file mode 100644
index 0000000..e998d27
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.hlsl
@@ -0,0 +1,18 @@
+#ifndef WGSL_SPEC_CONSTANT_0
+#define WGSL_SPEC_CONSTANT_0 3u
+#endif
+static const uint x_3 = WGSL_SPEC_CONSTANT_0;
+#ifndef WGSL_SPEC_CONSTANT_2
+#define WGSL_SPEC_CONSTANT_2 7u
+#endif
+static const uint x_4 = WGSL_SPEC_CONSTANT_2;
+
+void comp_main_1() {
+ return;
+}
+
+[numthreads(3, 5, 7)]
+void comp_main() {
+ comp_main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.msl
new file mode 100644
index 0000000..020c4fe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+constant uint x_3 [[function_constant(0)]];
+constant uint x_4 [[function_constant(2)]];
+void comp_main_1() {
+ return;
+}
+
+kernel void comp_main() {
+ comp_main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.spvasm
new file mode 100644
index 0000000..6a4d2f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %comp_main "comp_main"
+ OpExecutionMode %comp_main LocalSize 3 5 7
+ OpName %x_3 "x_3"
+ OpName %x_4 "x_4"
+ OpName %comp_main_1 "comp_main_1"
+ OpName %comp_main "comp_main"
+ OpDecorate %x_3 SpecId 0
+ OpDecorate %x_4 SpecId 2
+ %uint = OpTypeInt 32 0
+ %x_3 = OpSpecConstant %uint 3
+ %x_4 = OpSpecConstant %uint 7
+ %void = OpTypeVoid
+ %4 = OpTypeFunction %void
+%comp_main_1 = OpFunction %void None %4
+ %7 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %comp_main = OpFunction %void None %4
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %comp_main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.wgsl
new file mode 100644
index 0000000..7ee6f41
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+[[override(0)]] let x_3 : u32 = 3u;
+
+[[override(2)]] let x_4 : u32 = 7u;
+
+fn comp_main_1() {
+ return;
+}
+
+[[stage(compute), workgroup_size(3, 5, 7)]]
+fn comp_main() {
+ comp_main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm
new file mode 100644
index 0000000..695dfcd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvParserTest_EmitFunctions_GenerateParamNames.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 17
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+OpName %mixed_params "mixed_params"
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%8 = OpTypeFunction %void %uint %float %int
+%mixed_params = OpFunction %void None %8
+%14 = OpFunctionParameter %uint
+%15 = OpFunctionParameter %float
+%16 = OpFunctionParameter %int
+%9 = OpLabel
+OpReturn
+OpFunctionEnd
+%1 = OpFunction %void None %4
+%10 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.hlsl
new file mode 100644
index 0000000..fa3e504
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void mixed_params(uint x_14, float x_15, int x_16) {
+ return;
+}
+
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.msl
new file mode 100644
index 0000000..09cf906
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void mixed_params(uint x_14, float x_15, int x_16) {
+ return;
+}
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.spvasm
new file mode 100644
index 0000000..d8023c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %mixed_params "mixed_params"
+ OpName %x_14 "x_14"
+ OpName %x_15 "x_15"
+ OpName %x_16 "x_16"
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %int = OpTypeInt 32 1
+ %1 = OpTypeFunction %void %uint %float %int
+ %11 = OpTypeFunction %void
+%mixed_params = OpFunction %void None %1
+ %x_14 = OpFunctionParameter %uint
+ %x_15 = OpFunctionParameter %float
+ %x_16 = OpFunctionParameter %int
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100_1 = OpFunction %void None %11
+ %13 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %11
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.wgsl
new file mode 100644
index 0000000..59ec144
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+fn mixed_params(x_14 : u32, x_15 : f32, x_16 : i32) {
+ return;
+}
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm
new file mode 100644
index 0000000..3735274
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm
@@ -0,0 +1,32 @@
+; Test: SpvParserTest_EmitFunctions_MixedParamTypes.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 14
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+OpName %mixed_params "mixed_params"
+OpName %a "a"
+OpName %b "b"
+OpName %c "c"
+%void = OpTypeVoid
+%7 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%11 = OpTypeFunction %void %uint %float %int
+%mixed_params = OpFunction %void None %11
+%a = OpFunctionParameter %uint
+%b = OpFunctionParameter %float
+%c = OpFunctionParameter %int
+%12 = OpLabel
+OpReturn
+OpFunctionEnd
+%1 = OpFunction %void None %7
+%13 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.hlsl
new file mode 100644
index 0000000..8bb064f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void mixed_params(uint a, float b, int c) {
+ return;
+}
+
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.msl
new file mode 100644
index 0000000..8c45f10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void mixed_params(uint a, float b, int c) {
+ return;
+}
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.spvasm
new file mode 100644
index 0000000..335fe4a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %mixed_params "mixed_params"
+ OpName %a "a"
+ OpName %b "b"
+ OpName %c "c"
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %int = OpTypeInt 32 1
+ %1 = OpTypeFunction %void %uint %float %int
+ %11 = OpTypeFunction %void
+%mixed_params = OpFunction %void None %1
+ %a = OpFunctionParameter %uint
+ %b = OpFunctionParameter %float
+ %c = OpFunctionParameter %int
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100_1 = OpFunction %void None %11
+ %13 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %11
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.wgsl
new file mode 100644
index 0000000..92df1dc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+fn mixed_params(a : u32, b : f32, c : i32) {
+ return;
+}
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm
new file mode 100644
index 0000000..86e4130
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm
@@ -0,0 +1,27 @@
+; Test: SpvParserTest_EmitFunctions_NonVoidResultType.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 12
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+OpName %ret_float "ret_float"
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float_0 = OpConstant %float 0
+%9 = OpTypeFunction %float
+%ret_float = OpFunction %float None %9
+%10 = OpLabel
+OpReturnValue %float_0
+OpFunctionEnd
+%1 = OpFunction %void None %4
+%11 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.hlsl
new file mode 100644
index 0000000..41e0477
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+float ret_float() {
+ return 0.0f;
+}
+
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.msl
new file mode 100644
index 0000000..e894cc3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+float ret_float() {
+ return 0.0f;
+}
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.spvasm
new file mode 100644
index 0000000..c059279
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %ret_float "ret_float"
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %float = OpTypeFloat 32
+ %1 = OpTypeFunction %float
+ %float_0 = OpConstant %float 0
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %ret_float = OpFunction %float None %1
+ %4 = OpLabel
+ OpReturnValue %float_0
+ OpFunctionEnd
+ %x_100_1 = OpFunction %void None %6
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %6
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.wgsl
new file mode 100644
index 0000000..4a62673
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+fn ret_float() -> f32 {
+ return 0.0;
+}
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm
new file mode 100644
index 0000000..cdb3e57
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm
@@ -0,0 +1,25 @@
+; Test: SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 10
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %1 "x_100"
+OpExecutionMode %1 OriginUpperLeft
+OpName %another_function "another_function"
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%another_function = OpFunction %void None %4
+%8 = OpLabel
+OpReturn
+OpFunctionEnd
+%1 = OpFunction %void None %4
+%9 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.hlsl
new file mode 100644
index 0000000..b63a391
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void another_function() {
+ return;
+}
+
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.msl
new file mode 100644
index 0000000..5d653d0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void another_function() {
+ return;
+}
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.spvasm
new file mode 100644
index 0000000..c3318d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 10
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %another_function "another_function"
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+%another_function = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100_1 = OpFunction %void None %1
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %8 = OpLabel
+ %9 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.wgsl
new file mode 100644
index 0000000..844ebc1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+fn another_function() {
+ return;
+}
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm
new file mode 100644
index 0000000..8371af7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvParserTest_EmitStatement_CallWithParams.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "x_100"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%5 = OpTypeFunction %uint %uint %uint
+%uint_42 = OpConstant %uint 42
+%uint_84 = OpConstant %uint 84
+%50 = OpFunction %uint None %5
+%51 = OpFunctionParameter %uint
+%52 = OpFunctionParameter %uint
+%8 = OpLabel
+%9 = OpIAdd %uint %51 %52
+OpReturnValue %9
+OpFunctionEnd
+%100 = OpFunction %void None %3
+%10 = OpLabel
+%1 = OpFunctionCall %uint %50 %uint_42 %uint_84
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.hlsl
new file mode 100644
index 0000000..1656622
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+uint x_50(uint x_51, uint x_52) {
+ return (x_51 + x_52);
+}
+
+void x_100_1() {
+ const uint x_1 = x_50(42u, 84u);
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.msl
new file mode 100644
index 0000000..8f4f1c3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint x_50(uint x_51, uint x_52) {
+ return (x_51 + x_52);
+}
+
+void x_100_1() {
+ uint const x_1 = x_50(42u, 84u);
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.spvasm
new file mode 100644
index 0000000..031e2c0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_50 "x_50"
+ OpName %x_51 "x_51"
+ OpName %x_52 "x_52"
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %uint = OpTypeInt 32 0
+ %1 = OpTypeFunction %uint %uint %uint
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %uint_42 = OpConstant %uint 42
+ %uint_84 = OpConstant %uint 84
+ %x_50 = OpFunction %uint None %1
+ %x_51 = OpFunctionParameter %uint
+ %x_52 = OpFunctionParameter %uint
+ %6 = OpLabel
+ %7 = OpIAdd %uint %x_51 %x_52
+ OpReturnValue %7
+ OpFunctionEnd
+ %x_100_1 = OpFunction %void None %8
+ %11 = OpLabel
+ %12 = OpFunctionCall %uint %x_50 %uint_42 %uint_84
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %8
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.wgsl
new file mode 100644
index 0000000..5673d62
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn x_50(x_51 : u32, x_52 : u32) -> u32 {
+ return (x_51 + x_52);
+}
+
+fn x_100_1() {
+ let x_1 : u32 = x_50(42u, 84u);
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm
new file mode 100644
index 0000000..1bcf149
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm
@@ -0,0 +1,25 @@
+; Test: SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "x_100"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%5 = OpTypeFunction %uint
+%uint_42 = OpConstant %uint 42
+%50 = OpFunction %uint None %5
+%7 = OpLabel
+OpReturnValue %uint_42
+OpFunctionEnd
+%100 = OpFunction %void None %3
+%8 = OpLabel
+%1 = OpFunctionCall %uint %50
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.hlsl
new file mode 100644
index 0000000..81982a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+uint x_50() {
+ return 42u;
+}
+
+void x_100_1() {
+ const uint x_1 = x_50();
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.msl
new file mode 100644
index 0000000..06d7dfc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint x_50() {
+ return 42u;
+}
+
+void x_100_1() {
+ uint const x_1 = x_50();
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.spvasm
new file mode 100644
index 0000000..9ab6a52
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_50 "x_50"
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %uint = OpTypeInt 32 0
+ %1 = OpTypeFunction %uint
+ %uint_42 = OpConstant %uint 42
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %x_50 = OpFunction %uint None %1
+ %4 = OpLabel
+ OpReturnValue %uint_42
+ OpFunctionEnd
+ %x_100_1 = OpFunction %void None %6
+ %9 = OpLabel
+ %10 = OpFunctionCall %uint %x_50
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %6
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.wgsl
new file mode 100644
index 0000000..bc149df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn x_50() -> u32 {
+ return 42u;
+}
+
+fn x_100_1() {
+ let x_1 : u32 = x_50();
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm
new file mode 100644
index 0000000..b0f3c5d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "x_100"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%5 = OpTypeFunction %uint
+%uint_42 = OpConstant %uint 42
+%_ptr_Function_uint = OpTypePointer Function %uint
+%50 = OpFunction %uint None %5
+%8 = OpLabel
+OpReturnValue %uint_42
+OpFunctionEnd
+%100 = OpFunction %void None %3
+%9 = OpLabel
+%10 = OpVariable %_ptr_Function_uint Function
+%1 = OpFunctionCall %uint %50
+OpStore %10 %1
+OpStore %10 %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.hlsl
new file mode 100644
index 0000000..23a62a5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.hlsl
@@ -0,0 +1,16 @@
+uint x_50() {
+ return 42u;
+}
+
+void x_100_1() {
+ uint x_10 = 0u;
+ const uint x_1 = x_50();
+ x_10 = x_1;
+ x_10 = x_1;
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.msl
new file mode 100644
index 0000000..68968cb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint x_50() {
+ return 42u;
+}
+
+void x_100_1() {
+ uint x_10 = 0u;
+ uint const x_1 = x_50();
+ x_10 = x_1;
+ x_10 = x_1;
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.spvasm
new file mode 100644
index 0000000..5437902
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_50 "x_50"
+ OpName %x_100_1 "x_100_1"
+ OpName %x_10 "x_10"
+ OpName %x_100 "x_100"
+ %uint = OpTypeInt 32 0
+ %1 = OpTypeFunction %uint
+ %uint_42 = OpConstant %uint 42
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %12 = OpConstantNull %uint
+ %x_50 = OpFunction %uint None %1
+ %4 = OpLabel
+ OpReturnValue %uint_42
+ OpFunctionEnd
+ %x_100_1 = OpFunction %void None %6
+ %9 = OpLabel
+ %x_10 = OpVariable %_ptr_Function_uint Function %12
+ %13 = OpFunctionCall %uint %x_50
+ OpStore %x_10 %13
+ OpStore %x_10 %13
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %6
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.wgsl
new file mode 100644
index 0000000..6fc6cb0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+fn x_50() -> u32 {
+ return 42u;
+}
+
+fn x_100_1() {
+ var x_10 : u32;
+ let x_1 : u32 = x_50();
+ x_10 = x_1;
+ x_10 = x_1;
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm
new file mode 100644
index 0000000..86d5c99
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm
@@ -0,0 +1,22 @@
+; Test: SpvParserTest_EmitStatement_VoidCallNoParams.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "x_100"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%50 = OpFunction %void None %3
+%4 = OpLabel
+OpReturn
+OpFunctionEnd
+%100 = OpFunction %void None %3
+%5 = OpLabel
+%1 = OpFunctionCall %void %50
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.hlsl
new file mode 100644
index 0000000..6b5bd6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.hlsl
@@ -0,0 +1,13 @@
+void x_50() {
+ return;
+}
+
+void x_100_1() {
+ x_50();
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.msl
new file mode 100644
index 0000000..a43084e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_50() {
+ return;
+}
+
+void x_100_1() {
+ x_50();
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.spvasm
new file mode 100644
index 0000000..340b927
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_50 "x_50"
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_50 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100_1 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_50
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.wgsl
new file mode 100644
index 0000000..b01d658
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn x_50() {
+ return;
+}
+
+fn x_100_1() {
+ x_50();
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm b/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm
new file mode 100644
index 0000000..251c452
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm
@@ -0,0 +1,29 @@
+; Test: SpvParserTest_Emit_GenerateParamNames.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "x_100"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float_0 = OpConstant %float 0
+%7 = OpTypeFunction %void %uint %float %int
+%200 = OpFunction %void None %7
+%14 = OpFunctionParameter %uint
+%15 = OpFunctionParameter %float
+%16 = OpFunctionParameter %int
+%8 = OpLabel
+OpReturn
+OpFunctionEnd
+%100 = OpFunction %void None %2
+%9 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.hlsl
new file mode 100644
index 0000000..71f2e86
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void x_200(uint x_14, float x_15, int x_16) {
+ return;
+}
+
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.msl
new file mode 100644
index 0000000..dc7c64f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_200(uint x_14, float x_15, int x_16) {
+ return;
+}
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.spvasm
new file mode 100644
index 0000000..057e45b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %x_14 "x_14"
+ OpName %x_15 "x_15"
+ OpName %x_16 "x_16"
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %int = OpTypeInt 32 1
+ %1 = OpTypeFunction %void %uint %float %int
+ %11 = OpTypeFunction %void
+ %x_200 = OpFunction %void None %1
+ %x_14 = OpFunctionParameter %uint
+ %x_15 = OpFunctionParameter %float
+ %x_16 = OpFunctionParameter %int
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100_1 = OpFunction %void None %11
+ %13 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %11
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.wgsl
new file mode 100644
index 0000000..336222e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+fn x_200(x_14 : u32, x_15 : f32, x_16 : i32) {
+ return;
+}
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm b/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm
new file mode 100644
index 0000000..0803ef1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm
@@ -0,0 +1,32 @@
+; Test: SpvParserTest_Emit_MixedParamTypes.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "x_100"
+OpExecutionMode %100 OriginUpperLeft
+OpName %a "a"
+OpName %b "b"
+OpName %c "c"
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float_0 = OpConstant %float 0
+%10 = OpTypeFunction %void %uint %float %int
+%200 = OpFunction %void None %10
+%a = OpFunctionParameter %uint
+%b = OpFunctionParameter %float
+%c = OpFunctionParameter %int
+%11 = OpLabel
+OpReturn
+OpFunctionEnd
+%100 = OpFunction %void None %5
+%12 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.hlsl
new file mode 100644
index 0000000..b662c26
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void x_200(uint a, float b, int c) {
+ return;
+}
+
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.msl
new file mode 100644
index 0000000..8c83ee2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_200(uint a, float b, int c) {
+ return;
+}
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.spvasm
new file mode 100644
index 0000000..b6b979f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.spvasm
@@ -0,0 +1,37 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %a "a"
+ OpName %b "b"
+ OpName %c "c"
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %int = OpTypeInt 32 1
+ %1 = OpTypeFunction %void %uint %float %int
+ %11 = OpTypeFunction %void
+ %x_200 = OpFunction %void None %1
+ %a = OpFunctionParameter %uint
+ %b = OpFunctionParameter %float
+ %c = OpFunctionParameter %int
+ %10 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100_1 = OpFunction %void None %11
+ %13 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %11
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.wgsl
new file mode 100644
index 0000000..49b5c4f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+fn x_200(a : u32, b : f32, c : i32) {
+ return;
+}
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm b/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm
new file mode 100644
index 0000000..457cce1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm
@@ -0,0 +1,26 @@
+; Test: SpvParserTest_Emit_NonVoidResultType.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 201
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "x_100"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float_0 = OpConstant %float 0
+%7 = OpTypeFunction %float
+%200 = OpFunction %float None %7
+%8 = OpLabel
+OpReturnValue %float_0
+OpFunctionEnd
+%100 = OpFunction %void None %2
+%9 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.hlsl
new file mode 100644
index 0000000..89368e3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+float x_200() {
+ return 0.0f;
+}
+
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.msl
new file mode 100644
index 0000000..7ad6db7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.msl
@@ -0,0 +1,16 @@
+#include <metal_stdlib>
+
+using namespace metal;
+float x_200() {
+ return 0.0f;
+}
+
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.spvasm
new file mode 100644
index 0000000..1ff2e3d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_200 "x_200"
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %float = OpTypeFloat 32
+ %1 = OpTypeFunction %float
+ %float_0 = OpConstant %float 0
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %x_200 = OpFunction %float None %1
+ %4 = OpLabel
+ OpReturnValue %float_0
+ OpFunctionEnd
+ %x_100_1 = OpFunction %void None %6
+ %9 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %6
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.wgsl
new file mode 100644
index 0000000..9eb339e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.wgsl
@@ -0,0 +1,12 @@
+fn x_200() -> f32 {
+ return 0.0;
+}
+
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm b/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm
new file mode 100644
index 0000000..82f9c88
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm
@@ -0,0 +1,21 @@
+; Test: SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "x_100"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%float = OpTypeFloat 32
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float_0 = OpConstant %float 0
+%100 = OpFunction %void None %2
+%7 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.hlsl
new file mode 100644
index 0000000..21d4c2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void x_100_1() {
+ return;
+}
+
+void x_100() {
+ x_100_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.msl
new file mode 100644
index 0000000..a84e722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void x_100_1() {
+ return;
+}
+
+fragment void x_100() {
+ x_100_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.spvasm
new file mode 100644
index 0000000..916c0a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %x_100 "x_100"
+ OpExecutionMode %x_100 OriginUpperLeft
+ OpName %x_100_1 "x_100_1"
+ OpName %x_100 "x_100"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %x_100_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %x_100 = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %x_100_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f1f8b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn x_100_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn x_100() {
+ x_100_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..1051c0e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFAdd %float %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..5d58eb8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_1 = (50.0f + 60.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..7ab5c8b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = (50.0f + 60.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..501b826
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpFAdd %float %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..b8519a2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : f32 = (50.0 + 60.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..89ef808d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFAdd %v2float %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..f481460
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float2 x_1 = (float2(50.0f, 60.0f) + float2(60.0f, 50.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..f8fced1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = (float2(50.0f, 60.0f) + float2(60.0f, 50.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..cd83094
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFAdd %v2float %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..9c3ae79
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<f32> = (vec2<f32>(50.0, 60.0) + vec2<f32>(60.0, 50.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..685f575
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFDiv %float %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..4f6b1b0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_1 = (50.0f / 60.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..3bb77d8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = (50.0f / 60.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..f7fb692
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpFDiv %float %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..20ce1ed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : f32 = (50.0 / 60.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..3a13a78
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFDiv %v2float %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..65ecc3b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float2 x_1 = (float2(50.0f, 60.0f) / float2(60.0f, 50.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..57a35d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = (float2(50.0f, 60.0f) / float2(60.0f, 50.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..f86e637
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFDiv %v2float %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..e4dcd9c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<f32> = (vec2<f32>(50.0, 60.0) / vec2<f32>(60.0, 50.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..305f5da
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFMul %float %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..b8f2184
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_1 = (50.0f * 60.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..80a14d6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = (50.0f * 60.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..1a418e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpFMul %float %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..1d65720
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : f32 = (50.0 * 60.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..1904838
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFMul %v2float %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..0329458
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float2 x_1 = (float2(50.0f, 60.0f) * float2(60.0f, 50.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..0a72f02
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = (float2(50.0f, 60.0f) * float2(60.0f, 50.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..e061df7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFMul %v2float %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..83da3ae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<f32> = (vec2<f32>(50.0, 60.0) * vec2<f32>(60.0, 50.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..58c15e3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFOrdEqual %bool %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..0fdafb9a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (50.0f == 60.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..ddbce69
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (50.0f == 60.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..183a0c4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpFOrdEqual %bool %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..bd904ba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (50.0 == 60.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..2a7b5df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFOrdEqual %v2bool %29 %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..1e8a0eb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (float2(50.0f, 60.0f) == float2(60.0f, 50.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..9a9ff78
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (float2(50.0f, 60.0f) == float2(60.0f, 50.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..51400be
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFOrdEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..e118682
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<f32>(50.0, 60.0) == vec2<f32>(60.0, 50.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..350e651
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFOrdGreaterThanEqual %bool %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..6b02277
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (50.0f >= 60.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..0b7e78b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (50.0f >= 60.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..2af4d48
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpFOrdGreaterThanEqual %bool %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..6474c9b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (50.0 >= 60.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..cc18d59
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFOrdGreaterThanEqual %v2bool %29 %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..cc6388a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (float2(50.0f, 60.0f) >= float2(60.0f, 50.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..c8ea69d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (float2(50.0f, 60.0f) >= float2(60.0f, 50.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..f9e0a1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFOrdGreaterThanEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..f33c013
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<f32>(50.0, 60.0) >= vec2<f32>(60.0, 50.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..eac7fe7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFOrdGreaterThan %bool %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..b395733
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (50.0f > 60.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..e2fec32
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (50.0f > 60.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..6add1d9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpFOrdGreaterThan %bool %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..9329898
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (50.0 > 60.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..0115b21
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFOrdGreaterThan %v2bool %29 %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..3d89201
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (float2(50.0f, 60.0f) > float2(60.0f, 50.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..d1312d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (float2(50.0f, 60.0f) > float2(60.0f, 50.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..f43f20b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFOrdGreaterThan %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..2ea7f10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<f32>(50.0, 60.0) > vec2<f32>(60.0, 50.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..addac95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFOrdLessThanEqual %bool %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..439cdfb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (50.0f <= 60.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..2bf9e39
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (50.0f <= 60.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..3a0cf56
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpFOrdLessThanEqual %bool %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..bbc2657
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (50.0 <= 60.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..52989cf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFOrdLessThanEqual %v2bool %29 %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..5a8aae4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (float2(50.0f, 60.0f) <= float2(60.0f, 50.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..a0d076d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (float2(50.0f, 60.0f) <= float2(60.0f, 50.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..9f63d6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFOrdLessThanEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..a3a429b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<f32>(50.0, 60.0) <= vec2<f32>(60.0, 50.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..c27638b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFOrdLessThan %bool %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..888c361
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (50.0f < 60.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..451287d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (50.0f < 60.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..9fb887e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpFOrdLessThan %bool %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..2f58a22
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (50.0 < 60.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..a02aee7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFOrdLessThan %v2bool %29 %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..050e47f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (float2(50.0f, 60.0f) < float2(60.0f, 50.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..1b992f8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (float2(50.0f, 60.0f) < float2(60.0f, 50.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..6565ef2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFOrdLessThan %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..2e3e352
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<f32>(50.0, 60.0) < vec2<f32>(60.0, 50.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..a65e42c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFOrdNotEqual %bool %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..d682505
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (50.0f != 60.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..60c4a54
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (50.0f != 60.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..fca4100
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpFOrdNotEqual %bool %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..8d1c5e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (50.0 != 60.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..1d641a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpFOrdNotEqual %v2bool %29 %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..22d3e82
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (float2(50.0f, 60.0f) != float2(60.0f, 50.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..65c26d3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (float2(50.0f, 60.0f) != float2(60.0f, 50.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..21f436e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFOrdNotEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..077fbf6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<f32>(50.0, 60.0) != vec2<f32>(60.0, 50.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..3ca4aca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFRem %float %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..1c931e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_1 = (50.0f % 60.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..b4462f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = fmod(50.0f, 60.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..a44c20a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpFRem %float %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..271d304
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : f32 = (50.0 % 60.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..1240f58
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFRem %v2float %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..becf790
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float2 x_1 = (float2(50.0f, 60.0f) % float2(60.0f, 50.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..8c46829
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = fmod(float2(50.0f, 60.0f), float2(60.0f, 50.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..573b966
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFRem %v2float %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..651cb6f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<f32> = (vec2<f32>(50.0, 60.0) % vec2<f32>(60.0, 50.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..ac2c821
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFSub %float %float_50 %float_60
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..1ea0507
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_1 = (50.0f - 60.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..b8bf490
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = (50.0f - 60.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..bbaa3eb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpFSub %float %float_50 %float_60
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..35c05a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : f32 = (50.0 - 60.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..267a16a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFSub %v2float %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..01938b0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float2 x_1 = (float2(50.0f, 60.0f) - float2(60.0f, 50.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..aba88c4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = (float2(50.0f, 60.0f) - float2(60.0f, 50.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..fa02a9e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %10 = OpConstantComposite %v2float %float_60 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpFSub %v2float %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..7c15eff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<f32> = (vec2<f32>(50.0, 60.0) - vec2<f32>(60.0, 50.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm
new file mode 100644
index 0000000..d80e15c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm
@@ -0,0 +1,92 @@
+; Test: SpvParserTest_GlslStd450_Degrees_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Degrees %float_50
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..0e53fc1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = (50.0f * 57.295780182f);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..8488e7a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = (50.0f * 57.295780182f);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..edc4086
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%float_57_2957802 = OpConstant %float 57.2957802
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %35 = OpFMul %float %float_50 %float_57_2957802
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..13bb1db
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = (50.0 * 57.295780182);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm
new file mode 100644
index 0000000..cca05b5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm
@@ -0,0 +1,92 @@
+; Test: SpvParserTest_GlslStd450_Degrees_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v3float %2 Degrees %54
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..8db1479
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float3 x_1 = (float3(60.0f, 70.0f, 50.0f) * float3((57.295780182f).xxx));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..0bc76fb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float3 const x_1 = (float3(60.0f, 70.0f, 50.0f) * float3(57.295780182f));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..8ed2398
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%float_57_2957802 = OpConstant %float 57.2957802
+ %35 = OpConstantComposite %v3float %float_57_2957802 %float_57_2957802 %float_57_2957802
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %36 = OpFMul %v3float %31 %35
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..2b55baa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec3<f32> = (vec3<f32>(60.0, 70.0, 50.0) * vec3<f32>(57.295780182));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm
new file mode 100644
index 0000000..f6991fd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm
@@ -0,0 +1,93 @@
+; Test: SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%99 = OpFAdd %float %f1 %f1
+%1 = OpExtInst %float %2 FaceForward %99 %f2 %f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..2c7cb1c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,33 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_99 = (f1 + f1);
+ const float x_1 = (((f2 * f3) < 0.0f) ? x_99 : -(x_99));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..40b47a9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_99 = (f1 + f1);
+ float const x_1 = select(-(x_99), x_99, ((f2 * f3) < 0.0f));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..7ee5ac8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,58 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %float_0 = OpConstant %float 0
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpFAdd %float %float_50 %float_50
+ %36 = OpFMul %float %float_60 %float_70
+ %38 = OpFOrdLessThan %bool %36 %float_0
+ %40 = OpFNegate %float %34
+ %35 = OpSelect %float %38 %34 %40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..7df3903
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_99 : f32 = (f1 + f1);
+ let x_1 : f32 = select(-(x_99), x_99, ((f2 * f3) < 0.0));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm
new file mode 100644
index 0000000..9763005
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm
@@ -0,0 +1,93 @@
+; Test: SpvParserTest_GlslStd450_FaceForward_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%99 = OpFAdd %v2float %v2f1 %v2f1
+%1 = OpExtInst %v2float %2 FaceForward %v2f1 %v2f2 %v2f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..33ab00f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.hlsl
@@ -0,0 +1,33 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_99 = (v2f1 + v2f1);
+ const float2 x_1 = faceforward(v2f1, v2f2, v2f3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..a689cf8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_99 = (v2f1 + v2f1);
+ float2 const x_1 = faceforward(v2f1, v2f2, v2f3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..a4bb534
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %36 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpFAdd %v2float %26 %26
+ %35 = OpExtInst %v2float %36 FaceForward %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..24e2556
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_99 : vec2<f32> = (v2f1 + v2f1);
+ let x_1 : vec2<f32> = faceForward(v2f1, v2f2, v2f3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm
new file mode 100644
index 0000000..634e506
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm
@@ -0,0 +1,92 @@
+; Test: SpvParserTest_GlslStd450_Radians_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Radians %float_50
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..5ac4b2d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = (50.0f * 0.017453292f);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..42cf7f6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = (50.0f * 0.017453292f);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..ff03441
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%float_0_0174532924 = OpConstant %float 0.0174532924
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %35 = OpFMul %float %float_50 %float_0_0174532924
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..babef61
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = (50.0 * 0.017453292);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm
new file mode 100644
index 0000000..5a2c048
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm
@@ -0,0 +1,92 @@
+; Test: SpvParserTest_GlslStd450_Radians_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v3float %2 Radians %54
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..63ead05
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float3 x_1 = (float3(60.0f, 70.0f, 50.0f) * float3((0.017453292f).xxx));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..c78ed47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float3 const x_1 = (float3(60.0f, 70.0f, 50.0f) * float3(0.017453292f));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..5b37b27
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%float_0_0174532924 = OpConstant %float 0.0174532924
+ %35 = OpConstantComposite %v3float %float_0_0174532924 %float_0_0174532924 %float_0_0174532924
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %36 = OpFMul %v3float %31 %35
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..2b00f74
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec3<f32> = (vec3<f32>(60.0, 70.0, 50.0) * vec3<f32>(0.017453292));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm
new file mode 100644
index 0000000..c2ae3f3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm
@@ -0,0 +1,94 @@
+; Test: SpvParserTest_GlslStd450_Reflect_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%98 = OpFAdd %float %f1 %f1
+%99 = OpFAdd %float %f2 %f2
+%1 = OpExtInst %float %2 Reflect %98 %99
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..4508a06
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,34 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_98 = (f1 + f1);
+ const float x_99 = (f2 + f2);
+ const float x_1 = (x_98 - (2.0f * (x_99 * (x_99 * x_98))));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..b6df305
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.msl
@@ -0,0 +1,37 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_98 = (f1 + f1);
+ float const x_99 = (f2 + f2);
+ float const x_1 = (x_98 - (2.0f * (x_99 * (x_99 * x_98))));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..75df323
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,58 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %float_2 = OpConstant %float 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpFAdd %float %float_50 %float_50
+ %35 = OpFAdd %float %float_60 %float_60
+ %37 = OpFMul %float %35 %34
+ %38 = OpFMul %float %35 %37
+ %39 = OpFMul %float %float_2 %38
+ %40 = OpFSub %float %34 %39
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..d49b8df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,33 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_98 : f32 = (f1 + f1);
+ let x_99 : f32 = (f2 + f2);
+ let x_1 : f32 = (x_98 - (2.0 * (x_99 * (x_99 * x_98))));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm
new file mode 100644
index 0000000..9ab2829
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm
@@ -0,0 +1,94 @@
+; Test: SpvParserTest_GlslStd450_Reflect_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%98 = OpFAdd %v2float %v2f1 %v2f1
+%99 = OpFAdd %v2float %v2f2 %v2f2
+%1 = OpExtInst %v2float %2 Reflect %98 %99
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..520cb20
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.hlsl
@@ -0,0 +1,34 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_98 = (v2f1 + v2f1);
+ const float2 x_99 = (v2f2 + v2f2);
+ const float2 x_1 = reflect(x_98, x_99);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..f2ea7f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.msl
@@ -0,0 +1,37 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_98 = (v2f1 + v2f1);
+ float2 const x_99 = (v2f2 + v2f2);
+ float2 const x_1 = reflect(x_98, x_99);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..d245c34
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ %37 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpFAdd %v2float %26 %26
+ %35 = OpFAdd %v2float %27 %27
+ %36 = OpExtInst %v2float %37 Reflect %34 %35
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..d7448e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.wgsl
@@ -0,0 +1,33 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_98 : vec2<f32> = (v2f1 + v2f1);
+ let x_99 : vec2<f32> = (v2f2 + v2f2);
+ let x_1 : vec2<f32> = reflect(x_98, x_99);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm
new file mode 100644
index 0000000..db593e2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm
@@ -0,0 +1,92 @@
+; Test: SpvParserTest_GlslStd450_Refract_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Refract %f1 %f2 %f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..bd33258
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = refract(float2(f1, 0.0f), float2(f2, 0.0f), f3).x;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..158f79e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = refract(float2(f1, 0.0f), float2(f2, 0.0f), f3).x;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..298630d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %float_0 = OpConstant %float 0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %37 = OpCompositeConstruct %v2float %float_50 %float_0
+ %38 = OpCompositeConstruct %v2float %float_60 %float_0
+ %34 = OpExtInst %v2float %35 Refract %37 %38 %float_70
+ %39 = OpCompositeExtract %float %34 0
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..8cd2c79
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = refract(vec2<f32>(f1, 0.0), vec2<f32>(f2, 0.0), f3).x;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm
new file mode 100644
index 0000000..b156136
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm
@@ -0,0 +1,92 @@
+; Test: SpvParserTest_GlslStd450_Refract_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Refract %v2f1 %v2f2 %f3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..edf4bcd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = refract(v2f1, v2f2, f3);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..9df2059
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = refract(v2f1, v2f2, f3);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..710ed48
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Refract %26 %27 %float_70
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..152b4f5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = refract(v2f1, v2f2, f3);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..e069bf3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIAdd %uint %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..a70664c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint((30 + asint(10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..6bd4685
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>((30 + as_type<int>(10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..39bd486
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpBitcast %int %uint_10
+ %11 = OpIAdd %int %int_30 %9
+ %5 = OpBitcast %uint %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..089a191
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>((30 + bitcast<i32>(10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..3968b70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIAdd %int %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..2bb3392
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 + asint(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..53b8e77
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 + as_type<int>(10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..3bc7079
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_10
+ %10 = OpIAdd %int %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..b44f1d5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 + bitcast<i32>(10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..8cd695f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIAdd %uint %uint_10 %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..f2e60bf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u + asuint(30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..a467ebf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u + as_type<uint>(30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..89a66db
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_30
+ %10 = OpIAdd %uint %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..b0965f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u + bitcast<u32>(30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..d7f1507
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIAdd %int %uint_20 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..76ee2db
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = asint((20u + 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..a01c1f2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = as_type<int>((20u + 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f4b334
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpIAdd %uint %uint_20 %uint_10
+ %5 = OpBitcast %int %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..2737419
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = bitcast<i32>((20u + 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..62aea1b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIAdd %v2uint %23 %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..d04ca14
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint((int2(30, 40) + asint(uint2(10u, 20u))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..057f374
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>((int2(30, 40) + as_type<int2>(uint2(10u, 20u))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..c74351c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %16 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2int %16
+ %17 = OpIAdd %v2int %12 %13
+ %5 = OpBitcast %v2uint %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..8a2483b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30, 40) + bitcast<vec2<i32>>(vec2<u32>(10u, 20u))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..a2ef843
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIAdd %v2int %21 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..62873fd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = asint((uint2(10u, 20u) + asuint(int2(40, 30))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..904d114
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = as_type<int2>((uint2(10u, 20u) + as_type<uint2>(int2(40, 30))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..d0b6e63
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %16 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2uint %16
+ %17 = OpIAdd %v2uint %12 %13
+ %5 = OpBitcast %v2int %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..915a5d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = bitcast<vec2<i32>>((vec2<u32>(10u, 20u) + bitcast<vec2<u32>>(vec2<i32>(40, 30))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..8f2a1b4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIAdd %uint %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..ae95ad5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u + 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..dbe5779
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u + 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..14b7586
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpIAdd %uint %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..80e3cd9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u + 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..58e7dbb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIAdd %int %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..634063c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 + 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..7a5d330
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 + 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..fc75ca4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpIAdd %int %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..a51fe4e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 + 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..9247901
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIAdd %v2uint %21 %22
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..6a9156d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (uint2(10u, 20u) + uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..849afc5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = (uint2(10u, 20u) + uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..9d95c08
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpIAdd %v2uint %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..03de63f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = (vec2<u32>(10u, 20u) + vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..b716740
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIAdd %v2int %23 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..1dd9722
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(30, 40) + int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..409fe52
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(30, 40) + int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..edd0729
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpIAdd %v2int %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..67bf68e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(30, 40) + vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..78dcfa1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpIEqual %bool %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..c5abd6e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (10u == 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..ad4dbce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (10u == 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..d5aec7d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpIEqual %bool %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..0eebca7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (10u == 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..d3a3744
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpIEqual %bool %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..4bb04e2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (30 == 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..f441a6c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (30 == 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..282f307
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpIEqual %bool %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..3c86e10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (30 == 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..523a890
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpIEqual %bool %uint_10 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..1682c95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (10u == asuint(40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..7942900
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (10u == as_type<uint>(40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..b024031
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_40
+ %10 = OpIEqual %bool %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..6630862
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (10u == bitcast<u32>(40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..ceefe2e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpIEqual %bool %int_40 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..6f61155
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (40 == asint(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..76aecf0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (40 == as_type<int>(10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..c924384
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_40 = OpConstant %int 40
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_10
+ %10 = OpIEqual %bool %int_40 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..24d16f1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (40 == bitcast<i32>(10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..5a62dd4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpIEqual %v2bool %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..8cb8a41
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (uint2(10u, 20u) == uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..33ef672
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (uint2(10u, 20u) == uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..207a092
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpIEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..896c40d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<u32>(10u, 20u) == vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..02e447e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpIEqual %v2bool %27 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..cb31165
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (int2(30, 40) == int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..f137971
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (int2(30, 40) == int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..794aee3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpIEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..9678081
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<i32>(30, 40) == vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..46635df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIMul %uint %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..13437e5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint((30 * asint(10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..16997fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>((30 * as_type<int>(10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..c03046e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpBitcast %int %uint_10
+ %11 = OpIMul %int %int_30 %9
+ %5 = OpBitcast %uint %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..fdae772
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>((30 * bitcast<i32>(10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..1b706c3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIMul %int %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..dab2168
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 * asint(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..e44de6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 * as_type<int>(10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..9805f02
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_10
+ %10 = OpIMul %int %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..ed7343b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 * bitcast<i32>(10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..a4f7a92
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIMul %uint %uint_10 %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..19b4984
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u * asuint(30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..7bb6fb5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u * as_type<uint>(30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..cf4bf78
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_30
+ %10 = OpIMul %uint %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..f055e20
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u * bitcast<u32>(30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..8e86c6c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIMul %int %uint_20 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..685e5ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = asint((20u * 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..0c63299
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = as_type<int>((20u * 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..a07c1b8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpIMul %uint %uint_20 %uint_10
+ %5 = OpBitcast %int %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..70f4e23
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = bitcast<i32>((20u * 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..f90207c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIMul %v2uint %23 %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..c2db694
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint((int2(30, 40) * asint(uint2(10u, 20u))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..004e320
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>((int2(30, 40) * as_type<int2>(uint2(10u, 20u))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..446dd1b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %16 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2int %16
+ %17 = OpIMul %v2int %12 %13
+ %5 = OpBitcast %v2uint %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..163b209
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30, 40) * bitcast<vec2<i32>>(vec2<u32>(10u, 20u))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..8be7d4f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIMul %v2int %21 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..11199ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = asint((uint2(10u, 20u) * asuint(int2(40, 30))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..d8943b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = as_type<int2>((uint2(10u, 20u) * as_type<uint2>(int2(40, 30))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..f3b4b79
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %16 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2uint %16
+ %17 = OpIMul %v2uint %12 %13
+ %5 = OpBitcast %v2int %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..3ff7bf1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = bitcast<vec2<i32>>((vec2<u32>(10u, 20u) * bitcast<vec2<u32>>(vec2<i32>(40, 30))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..3b3c8fe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIMul %uint %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..32fd039
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u * 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..ff512b9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u * 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..4cbc23f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpIMul %uint %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..db992a1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u * 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..67bcda6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIMul %int %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..8b7ddea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 * 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..97abd51
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 * 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..054491b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpIMul %int %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..3605549
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 * 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..a2ba7b5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIMul %v2uint %21 %22
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..e903d31
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (uint2(10u, 20u) * uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..031e2c7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = (uint2(10u, 20u) * uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..b149d90
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpIMul %v2uint %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..302f1bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = (vec2<u32>(10u, 20u) * vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..7af6f69
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpIMul %v2int %23 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..a902abb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(30, 40) * int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..c0ed5fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(30, 40) * int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..1f8967f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpIMul %v2int %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..463a31d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(30, 40) * vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..3d09524
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpINotEqual %bool %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..9a1ea1d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (10u != 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..27fa617
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (10u != 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..7080284
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpINotEqual %bool %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..289af88
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (10u != 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..2a7c4bc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpINotEqual %bool %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..d5e6e89
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (30 != 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..6c5304d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (30 != 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..136ca1e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpINotEqual %bool %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..5f798f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (30 != 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..dbd2ac2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpINotEqual %bool %uint_10 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..cefd02d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (10u != asuint(40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..aaebd00
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (10u != as_type<uint>(40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..0ac55ae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_40
+ %10 = OpINotEqual %bool %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..b48ae51
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (10u != bitcast<u32>(40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..bbe6493
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpINotEqual %bool %int_40 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..95bd50f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (40 != asint(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..e2bd1fd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (40 != as_type<int>(10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..e77eeb1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_40 = OpConstant %int 40
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_10
+ %10 = OpINotEqual %bool %int_40 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..0426f71
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (40 != bitcast<i32>(10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..51c37e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpINotEqual %v2bool %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..ea71e08
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (uint2(10u, 20u) != uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..4a0b714
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (uint2(10u, 20u) != uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..f5542c5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpINotEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..71bef4a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<u32>(10u, 20u) != vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..d563a37
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpINotEqual %v2bool %27 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..c14b6a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (int2(30, 40) != int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..5d3fdd9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (int2(30, 40) != int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..32b1360
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpINotEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..507065d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<i32>(30, 40) != vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..c8afa21
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpISub %uint %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..9f28ae3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint((30 - asint(10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..d0a0b1a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>((30 - as_type<int>(10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..5b1b6d6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpBitcast %int %uint_10
+ %11 = OpISub %int %int_30 %9
+ %5 = OpBitcast %uint %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..114a500
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>((30 - bitcast<i32>(10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..e502abd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpISub %int %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..9f0aea8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 - asint(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..2e450fe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 - as_type<int>(10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..a1d2f9c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_10
+ %10 = OpISub %int %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..2ba4104
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 - bitcast<i32>(10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..40d166b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpISub %uint %uint_10 %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..1fb98d0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u - asuint(30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..4783009
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u - as_type<uint>(30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..e696da6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_30
+ %10 = OpISub %uint %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..a5696bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u - bitcast<u32>(30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..caa5466
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpISub %int %uint_20 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..d52f28d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = asint((20u - 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..d8d6962
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = as_type<int>((20u - 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..4376189
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpISub %uint %uint_20 %uint_10
+ %5 = OpBitcast %int %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..5f47fc6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = bitcast<i32>((20u - 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..c5599b3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpISub %v2uint %23 %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..dc9ae97
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint((int2(30, 40) - asint(uint2(10u, 20u))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..7caef80
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>((int2(30, 40) - as_type<int2>(uint2(10u, 20u))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..b28b112
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %16 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2int %16
+ %17 = OpISub %v2int %12 %13
+ %5 = OpBitcast %v2uint %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..4552c14
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30, 40) - bitcast<vec2<i32>>(vec2<u32>(10u, 20u))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..04dd44b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpISub %v2int %21 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..055f410
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = asint((uint2(10u, 20u) - asuint(int2(40, 30))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..e4dd9d0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = as_type<int2>((uint2(10u, 20u) - as_type<uint2>(int2(40, 30))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..0bfbe9b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %16 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2uint %16
+ %17 = OpISub %v2uint %12 %13
+ %5 = OpBitcast %v2int %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..2aad01e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = bitcast<vec2<i32>>((vec2<u32>(10u, 20u) - bitcast<vec2<u32>>(vec2<i32>(40, 30))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..1c07ef0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpISub %uint %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..cdb420b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u - 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..1232f61
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u - 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..f625348
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpISub %uint %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..d9230b5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u - 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..57fab25
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpISub %int %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..80fc1e3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 - 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..f75aa31
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 - 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..63364b9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpISub %int %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..d4c522a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 - 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..6ed7f0a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpISub %v2uint %21 %22
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..5ca61a8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (uint2(10u, 20u) - uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..dba660b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = (uint2(10u, 20u) - uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..f9c645d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpISub %v2uint %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..2078358
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = (vec2<u32>(10u, 20u) - vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..9a9ddbf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpISub %v2int %23 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..2e9894b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(30, 40) - int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..525e924
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(30, 40) - int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..bad9c62
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpISub %v2int %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..0194db8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(30, 40) - vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm
new file mode 100644
index 0000000..8072013
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm
@@ -0,0 +1,17 @@
+; Test: SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 5
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %1 "main"
+OpExecutionMode %1 LocalSize 1 1 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%1 = OpFunction %void None %3
+%4 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.hlsl
new file mode 100644
index 0000000..7d04ef1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.msl
new file mode 100644
index 0000000..1de7f83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.spvasm
new file mode 100644
index 0000000..0114d7e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.wgsl
new file mode 100644
index 0000000..05ff825
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm
new file mode 100644
index 0000000..ed56608
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm
@@ -0,0 +1,17 @@
+; Test: SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 5
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %1 "main"
+OpExecutionMode %1 LocalSize 1 1 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%1 = OpFunction %void None %3
+%4 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.hlsl
new file mode 100644
index 0000000..7d04ef1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.msl
new file mode 100644
index 0000000..1de7f83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.spvasm
new file mode 100644
index 0000000..0114d7e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.wgsl
new file mode 100644
index 0000000..05ff825
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm
new file mode 100644
index 0000000..0da7cd2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 5
+; Schema: 0
+OpCapability Shader
+OpCapability VulkanMemoryModel
+OpExtension "SPV_KHR_vulkan_memory_model"
+OpMemoryModel Logical Vulkan
+OpEntryPoint GLCompute %1 "main"
+OpExecutionMode %1 LocalSize 1 1 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%1 = OpFunction %void None %3
+%4 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.hlsl
new file mode 100644
index 0000000..7d04ef1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.msl
new file mode 100644
index 0000000..1de7f83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.spvasm
new file mode 100644
index 0000000..0114d7e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.wgsl
new file mode 100644
index 0000000..05ff825
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm
new file mode 100644
index 0000000..faba8e3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm
@@ -0,0 +1,18 @@
+; Test: SpvParserTest_Impl_Source_InvalidId.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 16
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %2 "main"
+OpExecutionMode %2 LocalSize 1 1 1
+%15 = OpString "myfile"
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%2 = OpFunction %void None %4
+%1 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.hlsl
new file mode 100644
index 0000000..7d04ef1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.msl
new file mode 100644
index 0000000..1de7f83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.spvasm
new file mode 100644
index 0000000..0114d7e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.wgsl
new file mode 100644
index 0000000..05ff825
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm
new file mode 100644
index 0000000..880e9d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm
@@ -0,0 +1,19 @@
+; Test: SpvParserTest_Impl_Source_NoOpLine.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 61
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %2 "main"
+OpExecutionMode %2 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%60 = OpConstantNull %uint
+%2 = OpFunction %void None %4
+%1 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.hlsl
new file mode 100644
index 0000000..7d04ef1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.msl
new file mode 100644
index 0000000..1de7f83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.spvasm
new file mode 100644
index 0000000..0114d7e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.wgsl
new file mode 100644
index 0000000..05ff825
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm
new file mode 100644
index 0000000..8735284
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm
@@ -0,0 +1,22 @@
+; Test: SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 61
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %2 "main"
+OpExecutionMode %2 LocalSize 1 1 1
+%15 = OpString "myfile"
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+OpLine %15 42 53
+%uint = OpTypeInt 32 0
+%60 = OpConstantNull %uint
+OpNoLine
+%2 = OpFunction %void None %4
+%1 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.hlsl
new file mode 100644
index 0000000..7d04ef1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.msl
new file mode 100644
index 0000000..1de7f83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.spvasm
new file mode 100644
index 0000000..0114d7e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.wgsl
new file mode 100644
index 0000000..05ff825
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..3aa8fc8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpLogicalAnd %bool %true %false
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..6ff4e0d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (true & false);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..3a9a17c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (true & false);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..7e7b5fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpLogicalAnd %bool %true %false
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..31d0cda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (true & false);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..e66a4a5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpLogicalAnd %v2bool %23 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..d4c3151
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (bool2(true, false) & bool2(false, true));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..a742917
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (bool2(true, false) & bool2(false, true));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..d0f1211
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %9 = OpConstantComposite %v2bool %true %false
+ %10 = OpConstantComposite %v2bool %false %true
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpLogicalAnd %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..e433e28
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<bool>(true, false) & vec2<bool>(false, true));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..e288aab
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpLogicalEqual %bool %true %false
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..8cdd1c1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (true == false);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..6cbe165
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (true == false);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..47fb878
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpLogicalEqual %bool %true %false
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..d910851
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (true == false);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..15560ce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpLogicalEqual %v2bool %23 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..f5ac81a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (bool2(true, false) == bool2(false, true));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..83ad92b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (bool2(true, false) == bool2(false, true));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..ad3fd35
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %9 = OpConstantComposite %v2bool %true %false
+ %10 = OpConstantComposite %v2bool %false %true
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpLogicalEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..ab3500c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<bool>(true, false) == vec2<bool>(false, true));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..9e35b9a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpLogicalNotEqual %bool %true %false
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..44272bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (true != false);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..ddeb2de
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (true != false);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..f322a1d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpLogicalNotEqual %bool %true %false
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..9391abd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (true != false);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..3a9196e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpLogicalNotEqual %v2bool %23 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..7a639b2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (bool2(true, false) != bool2(false, true));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..e0133cf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (bool2(true, false) != bool2(false, true));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..78ae80c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %9 = OpConstantComposite %v2bool %true %false
+ %10 = OpConstantComposite %v2bool %false %true
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpLogicalNotEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..6919af3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<bool>(true, false) != vec2<bool>(false, true));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..0ac3551
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpLogicalOr %bool %true %false
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..839b7e6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (true | false);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..7fe4c06
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (true | false);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..fa39d05
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpLogicalOr %bool %true %false
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..08ce435
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (true | false);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..ec408f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpLogicalOr %v2bool %23 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..a46d24d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (bool2(true, false) | bool2(false, true));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..3bb31d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (bool2(true, false) | bool2(false, true));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..8df242a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %9 = OpConstantComposite %v2bool %true %false
+ %10 = OpConstantComposite %v2bool %false %true
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpLogicalOr %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..3a972a8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<bool>(true, false) | vec2<bool>(false, true));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm b/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm
new file mode 100644
index 0000000..526d0ef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm
@@ -0,0 +1,92 @@
+; Test: SpvParserTest_Normalize_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %float %2 Normalize %f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..e04c522
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float x_1 = 1.0f;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..08de93c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float const x_1 = 1.0f;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..2f01ae1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,52 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %float_1 = OpConstant %float 1
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..0495eff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : f32 = 1.0;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm
new file mode 100644
index 0000000..0560513
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm
@@ -0,0 +1,92 @@
+; Test: SpvParserTest_Normalize_Vector2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v2float %2 Normalize %v2f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.hlsl
new file mode 100644
index 0000000..b66ee0b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float2 x_1 = normalize(v2f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.msl
new file mode 100644
index 0000000..1b791c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float2 const x_1 = normalize(v2f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.spvasm
new file mode 100644
index 0000000..ac4aa8d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v2float %35 Normalize %26
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.wgsl
new file mode 100644
index 0000000..2ab7993
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec2<f32> = normalize(v2f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm
new file mode 100644
index 0000000..a817488
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm
@@ -0,0 +1,92 @@
+; Test: SpvParserTest_Normalize_Vector3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v3float %2 Normalize %v3f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.hlsl
new file mode 100644
index 0000000..7da5a59
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float3 x_1 = normalize(v3f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.msl
new file mode 100644
index 0000000..a75733d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float3 const x_1 = normalize(v3f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.spvasm
new file mode 100644
index 0000000..7381c81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v3float %35 Normalize %30
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.wgsl
new file mode 100644
index 0000000..8a15992
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec3<f32> = normalize(v3f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm
new file mode 100644
index 0000000..a19e8e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm
@@ -0,0 +1,92 @@
+; Test: SpvParserTest_Normalize_Vector4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%26 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%44 = OpConstantComposite %v2uint %uint_10 %uint_20
+%45 = OpConstantComposite %v2uint %uint_20 %uint_10
+%46 = OpConstantComposite %v2uint %uint_15 %uint_15
+%47 = OpConstantComposite %v2int %int_30 %int_40
+%48 = OpConstantComposite %v2int %int_40 %int_30
+%49 = OpConstantComposite %v2int %int_35 %int_35
+%50 = OpConstantComposite %v2float %float_50 %float_60
+%51 = OpConstantComposite %v2float %float_60 %float_50
+%52 = OpConstantComposite %v2float %float_70 %float_70
+%53 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%54 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%55 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %26
+%56 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %44
+%v2u2 = OpCopyObject %v2uint %45
+%v2u3 = OpCopyObject %v2uint %46
+%v2i1 = OpCopyObject %v2int %47
+%v2i2 = OpCopyObject %v2int %48
+%v2i3 = OpCopyObject %v2int %49
+%v2f1 = OpCopyObject %v2float %50
+%v2f2 = OpCopyObject %v2float %51
+%v2f3 = OpCopyObject %v2float %52
+%v3f1 = OpCopyObject %v3float %53
+%v3f2 = OpCopyObject %v3float %54
+%v4f1 = OpCopyObject %v4float %55
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %v4float %2 Normalize %v4f1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.hlsl
new file mode 100644
index 0000000..b613feb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.hlsl
@@ -0,0 +1,32 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const float4 x_1 = normalize(v4f1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.msl
new file mode 100644
index 0000000..818b1f8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ float4 const x_1 = normalize(v4f1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.spvasm
new file mode 100644
index 0000000..6c7867a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %35 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %34 = OpExtInst %v4float %35 Normalize %33
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.wgsl
new file mode 100644
index 0000000..82185ba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.wgsl
@@ -0,0 +1,31 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : vec4<f32> = normalize(v4f1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm
new file mode 100644
index 0000000..00b0f4a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm
@@ -0,0 +1,93 @@
+; Test: SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%3 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%27 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%45 = OpConstantComposite %v2uint %uint_10 %uint_20
+%46 = OpConstantComposite %v2uint %uint_20 %uint_10
+%47 = OpConstantComposite %v2uint %uint_15 %uint_15
+%48 = OpConstantComposite %v2int %int_30 %int_40
+%49 = OpConstantComposite %v2int %int_40 %int_30
+%50 = OpConstantComposite %v2int %int_35 %int_35
+%51 = OpConstantComposite %v2float %float_50 %float_60
+%52 = OpConstantComposite %v2float %float_60 %float_50
+%53 = OpConstantComposite %v2float %float_70 %float_70
+%54 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%55 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%56 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %27
+%57 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %45
+%v2u2 = OpCopyObject %v2uint %46
+%v2u3 = OpCopyObject %v2uint %47
+%v2i1 = OpCopyObject %v2int %48
+%v2i2 = OpCopyObject %v2int %49
+%v2i3 = OpCopyObject %v2int %50
+%v2f1 = OpCopyObject %v2float %51
+%v2f2 = OpCopyObject %v2float %52
+%v2f3 = OpCopyObject %v2float %53
+%v3f1 = OpCopyObject %v3float %54
+%v3f2 = OpCopyObject %v3float %55
+%v4f1 = OpCopyObject %v4float %56
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %uint %3 SAbs %u1
+%2 = OpExtInst %v2uint %3 SAbs %v2u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.hlsl
new file mode 100644
index 0000000..88f882a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.hlsl
@@ -0,0 +1,33 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint x_1 = asuint(abs(asint(u1)));
+ const uint2 x_2 = asuint(abs(asint(v2u1)));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.msl
new file mode 100644
index 0000000..5f2b521
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint const x_1 = as_type<uint>(abs(as_type<int>(u1)));
+ uint2 const x_2 = as_type<uint2>(abs(as_type<int2>(v2u1)));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.spvasm
new file mode 100644
index 0000000..470c7df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.spvasm
@@ -0,0 +1,58 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ %36 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %37 = OpBitcast %int %uint_10
+ %35 = OpExtInst %int %36 SAbs %37
+ %34 = OpBitcast %uint %35
+ %40 = OpBitcast %v2int %18
+ %39 = OpExtInst %v2int %36 SAbs %40
+ %38 = OpBitcast %v2uint %39
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.wgsl
new file mode 100644
index 0000000..491fb35
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : u32 = bitcast<u32>(abs(bitcast<i32>(u1)));
+ let x_2 : vec2<u32> = bitcast<vec2<u32>>(abs(bitcast<vec2<i32>>(v2u1)));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm
new file mode 100644
index 0000000..823c583
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm
@@ -0,0 +1,93 @@
+; Test: SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%3 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%27 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%45 = OpConstantComposite %v2uint %uint_10 %uint_20
+%46 = OpConstantComposite %v2uint %uint_20 %uint_10
+%47 = OpConstantComposite %v2uint %uint_15 %uint_15
+%48 = OpConstantComposite %v2int %int_30 %int_40
+%49 = OpConstantComposite %v2int %int_40 %int_30
+%50 = OpConstantComposite %v2int %int_35 %int_35
+%51 = OpConstantComposite %v2float %float_50 %float_60
+%52 = OpConstantComposite %v2float %float_60 %float_50
+%53 = OpConstantComposite %v2float %float_70 %float_70
+%54 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%55 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%56 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %27
+%57 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %45
+%v2u2 = OpCopyObject %v2uint %46
+%v2u3 = OpCopyObject %v2uint %47
+%v2i1 = OpCopyObject %v2int %48
+%v2i2 = OpCopyObject %v2int %49
+%v2i3 = OpCopyObject %v2int %50
+%v2f1 = OpCopyObject %v2float %51
+%v2f2 = OpCopyObject %v2float %52
+%v2f3 = OpCopyObject %v2float %53
+%v3f1 = OpCopyObject %v3float %54
+%v3f2 = OpCopyObject %v3float %55
+%v4f1 = OpCopyObject %v4float %56
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %uint %3 SClamp %u1 %i2 %u3
+%2 = OpExtInst %v2uint %3 SClamp %v2u1 %v2i2 %v2u3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.hlsl
new file mode 100644
index 0000000..6f41bb3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.hlsl
@@ -0,0 +1,33 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint x_1 = asuint(clamp(asint(u1), i2, asint(u3)));
+ const uint2 x_2 = asuint(clamp(asint(v2u1), v2i2, asint(v2u3)));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.msl
new file mode 100644
index 0000000..e4b7ad4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint const x_1 = as_type<uint>(clamp(as_type<int>(u1), i2, as_type<int>(u3)));
+ uint2 const x_2 = as_type<uint2>(clamp(as_type<int2>(v2u1), v2i2, as_type<int2>(v2u3)));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.spvasm
new file mode 100644
index 0000000..b3fde4f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ %36 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %37 = OpBitcast %int %uint_10
+ %38 = OpBitcast %int %uint_20
+ %35 = OpExtInst %int %36 SClamp %37 %int_35 %38
+ %34 = OpBitcast %uint %35
+ %41 = OpBitcast %v2int %18
+ %42 = OpBitcast %v2int %20
+ %40 = OpExtInst %v2int %36 SClamp %41 %23 %42
+ %39 = OpBitcast %v2uint %40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.wgsl
new file mode 100644
index 0000000..e09d7df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : u32 = bitcast<u32>(clamp(bitcast<i32>(u1), i2, bitcast<i32>(u3)));
+ let x_2 : vec2<u32> = bitcast<vec2<u32>>(clamp(bitcast<vec2<i32>>(v2u1), v2i2, bitcast<vec2<i32>>(v2u3)));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm
new file mode 100644
index 0000000..3bc4ce6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm
@@ -0,0 +1,93 @@
+; Test: SpvParserTest_RectifyOperandsAndResult_SMax.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%3 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%27 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%45 = OpConstantComposite %v2uint %uint_10 %uint_20
+%46 = OpConstantComposite %v2uint %uint_20 %uint_10
+%47 = OpConstantComposite %v2uint %uint_15 %uint_15
+%48 = OpConstantComposite %v2int %int_30 %int_40
+%49 = OpConstantComposite %v2int %int_40 %int_30
+%50 = OpConstantComposite %v2int %int_35 %int_35
+%51 = OpConstantComposite %v2float %float_50 %float_60
+%52 = OpConstantComposite %v2float %float_60 %float_50
+%53 = OpConstantComposite %v2float %float_70 %float_70
+%54 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%55 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%56 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %27
+%57 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %45
+%v2u2 = OpCopyObject %v2uint %46
+%v2u3 = OpCopyObject %v2uint %47
+%v2i1 = OpCopyObject %v2int %48
+%v2i2 = OpCopyObject %v2int %49
+%v2i3 = OpCopyObject %v2int %50
+%v2f1 = OpCopyObject %v2float %51
+%v2f2 = OpCopyObject %v2float %52
+%v2f3 = OpCopyObject %v2float %53
+%v3f1 = OpCopyObject %v3float %54
+%v3f2 = OpCopyObject %v3float %55
+%v4f1 = OpCopyObject %v4float %56
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %uint %3 SMax %u1 %u2
+%2 = OpExtInst %v2uint %3 SMax %v2u1 %v2u2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.hlsl
new file mode 100644
index 0000000..93cc10b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.hlsl
@@ -0,0 +1,33 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint x_1 = asuint(max(asint(u1), asint(u2)));
+ const uint2 x_2 = asuint(max(asint(v2u1), asint(v2u2)));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.msl
new file mode 100644
index 0000000..d57ffef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint const x_1 = as_type<uint>(max(as_type<int>(u1), as_type<int>(u2)));
+ uint2 const x_2 = as_type<uint2>(max(as_type<int2>(v2u1), as_type<int2>(v2u2)));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.spvasm
new file mode 100644
index 0000000..0d65721
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ %36 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %37 = OpBitcast %int %uint_10
+ %38 = OpBitcast %int %uint_15
+ %35 = OpExtInst %int %36 SMax %37 %38
+ %34 = OpBitcast %uint %35
+ %41 = OpBitcast %v2int %18
+ %42 = OpBitcast %v2int %19
+ %40 = OpExtInst %v2int %36 SMax %41 %42
+ %39 = OpBitcast %v2uint %40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.wgsl
new file mode 100644
index 0000000..645cbeb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : u32 = bitcast<u32>(max(bitcast<i32>(u1), bitcast<i32>(u2)));
+ let x_2 : vec2<u32> = bitcast<vec2<u32>>(max(bitcast<vec2<i32>>(v2u1), bitcast<vec2<i32>>(v2u2)));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm
new file mode 100644
index 0000000..a9bd9f9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm
@@ -0,0 +1,93 @@
+; Test: SpvParserTest_RectifyOperandsAndResult_SMin.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%3 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%27 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%45 = OpConstantComposite %v2uint %uint_10 %uint_20
+%46 = OpConstantComposite %v2uint %uint_20 %uint_10
+%47 = OpConstantComposite %v2uint %uint_15 %uint_15
+%48 = OpConstantComposite %v2int %int_30 %int_40
+%49 = OpConstantComposite %v2int %int_40 %int_30
+%50 = OpConstantComposite %v2int %int_35 %int_35
+%51 = OpConstantComposite %v2float %float_50 %float_60
+%52 = OpConstantComposite %v2float %float_60 %float_50
+%53 = OpConstantComposite %v2float %float_70 %float_70
+%54 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%55 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%56 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %27
+%57 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %45
+%v2u2 = OpCopyObject %v2uint %46
+%v2u3 = OpCopyObject %v2uint %47
+%v2i1 = OpCopyObject %v2int %48
+%v2i2 = OpCopyObject %v2int %49
+%v2i3 = OpCopyObject %v2int %50
+%v2f1 = OpCopyObject %v2float %51
+%v2f2 = OpCopyObject %v2float %52
+%v2f3 = OpCopyObject %v2float %53
+%v3f1 = OpCopyObject %v3float %54
+%v3f2 = OpCopyObject %v3float %55
+%v4f1 = OpCopyObject %v4float %56
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %uint %3 SMin %u1 %u2
+%2 = OpExtInst %v2uint %3 SMin %v2u1 %v2u2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.hlsl
new file mode 100644
index 0000000..bfd2e77
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.hlsl
@@ -0,0 +1,33 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const uint x_1 = asuint(min(asint(u1), asint(u2)));
+ const uint2 x_2 = asuint(min(asint(v2u1), asint(v2u2)));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.msl
new file mode 100644
index 0000000..788552e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ uint const x_1 = as_type<uint>(min(as_type<int>(u1), as_type<int>(u2)));
+ uint2 const x_2 = as_type<uint2>(min(as_type<int2>(v2u1), as_type<int2>(v2u2)));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.spvasm
new file mode 100644
index 0000000..b74dc36
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ %36 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %37 = OpBitcast %int %uint_10
+ %38 = OpBitcast %int %uint_15
+ %35 = OpExtInst %int %36 SMin %37 %38
+ %34 = OpBitcast %uint %35
+ %41 = OpBitcast %v2int %18
+ %42 = OpBitcast %v2int %19
+ %40 = OpExtInst %v2int %36 SMin %41 %42
+ %39 = OpBitcast %v2uint %40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.wgsl
new file mode 100644
index 0000000..2ef32a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : u32 = bitcast<u32>(min(bitcast<i32>(u1), bitcast<i32>(u2)));
+ let x_2 : vec2<u32> = bitcast<vec2<u32>>(min(bitcast<vec2<i32>>(v2u1), bitcast<vec2<i32>>(v2u2)));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm
new file mode 100644
index 0000000..a5eebdf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm
@@ -0,0 +1,93 @@
+; Test: SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%3 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%27 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%45 = OpConstantComposite %v2uint %uint_10 %uint_20
+%46 = OpConstantComposite %v2uint %uint_20 %uint_10
+%47 = OpConstantComposite %v2uint %uint_15 %uint_15
+%48 = OpConstantComposite %v2int %int_30 %int_40
+%49 = OpConstantComposite %v2int %int_40 %int_30
+%50 = OpConstantComposite %v2int %int_35 %int_35
+%51 = OpConstantComposite %v2float %float_50 %float_60
+%52 = OpConstantComposite %v2float %float_60 %float_50
+%53 = OpConstantComposite %v2float %float_70 %float_70
+%54 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%55 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%56 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %27
+%57 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %45
+%v2u2 = OpCopyObject %v2uint %46
+%v2u3 = OpCopyObject %v2uint %47
+%v2i1 = OpCopyObject %v2int %48
+%v2i2 = OpCopyObject %v2int %49
+%v2i3 = OpCopyObject %v2int %50
+%v2f1 = OpCopyObject %v2float %51
+%v2f2 = OpCopyObject %v2float %52
+%v2f3 = OpCopyObject %v2float %53
+%v3f1 = OpCopyObject %v3float %54
+%v3f2 = OpCopyObject %v3float %55
+%v4f1 = OpCopyObject %v4float %56
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %int %3 UClamp %i1 %u2 %i3
+%2 = OpExtInst %v2int %3 UClamp %v2i1 %v2u2 %v2i3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.hlsl
new file mode 100644
index 0000000..3e0abef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.hlsl
@@ -0,0 +1,33 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const int x_1 = asint(clamp(asuint(i1), u2, asuint(i3)));
+ const int2 x_2 = asint(clamp(asuint(v2i1), v2u2, asuint(v2i3)));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.msl
new file mode 100644
index 0000000..f96a5c4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ int const x_1 = as_type<int>(clamp(as_type<uint>(i1), u2, as_type<uint>(i3)));
+ int2 const x_2 = as_type<int2>(clamp(as_type<uint2>(v2i1), v2u2, as_type<uint2>(v2i3)));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.spvasm
new file mode 100644
index 0000000..523237d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ %36 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %37 = OpBitcast %uint %int_30
+ %38 = OpBitcast %uint %int_40
+ %35 = OpExtInst %uint %36 UClamp %37 %uint_15 %38
+ %34 = OpBitcast %int %35
+ %41 = OpBitcast %v2uint %22
+ %42 = OpBitcast %v2uint %24
+ %40 = OpExtInst %v2uint %36 UClamp %41 %19 %42
+ %39 = OpBitcast %v2int %40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.wgsl
new file mode 100644
index 0000000..a4a8e84
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : i32 = bitcast<i32>(clamp(bitcast<u32>(i1), u2, bitcast<u32>(i3)));
+ let x_2 : vec2<i32> = bitcast<vec2<i32>>(clamp(bitcast<vec2<u32>>(v2i1), v2u2, bitcast<vec2<u32>>(v2i3)));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm
new file mode 100644
index 0000000..f8b6b28
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm
@@ -0,0 +1,93 @@
+; Test: SpvParserTest_RectifyOperandsAndResult_UMax.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%3 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%27 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%45 = OpConstantComposite %v2uint %uint_10 %uint_20
+%46 = OpConstantComposite %v2uint %uint_20 %uint_10
+%47 = OpConstantComposite %v2uint %uint_15 %uint_15
+%48 = OpConstantComposite %v2int %int_30 %int_40
+%49 = OpConstantComposite %v2int %int_40 %int_30
+%50 = OpConstantComposite %v2int %int_35 %int_35
+%51 = OpConstantComposite %v2float %float_50 %float_60
+%52 = OpConstantComposite %v2float %float_60 %float_50
+%53 = OpConstantComposite %v2float %float_70 %float_70
+%54 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%55 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%56 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %27
+%57 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %45
+%v2u2 = OpCopyObject %v2uint %46
+%v2u3 = OpCopyObject %v2uint %47
+%v2i1 = OpCopyObject %v2int %48
+%v2i2 = OpCopyObject %v2int %49
+%v2i3 = OpCopyObject %v2int %50
+%v2f1 = OpCopyObject %v2float %51
+%v2f2 = OpCopyObject %v2float %52
+%v2f3 = OpCopyObject %v2float %53
+%v3f1 = OpCopyObject %v3float %54
+%v3f2 = OpCopyObject %v3float %55
+%v4f1 = OpCopyObject %v4float %56
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %int %3 UMax %i1 %i2
+%2 = OpExtInst %v2int %3 UMax %v2i1 %v2i2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.hlsl
new file mode 100644
index 0000000..53c460a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.hlsl
@@ -0,0 +1,33 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const int x_1 = asint(max(asuint(i1), asuint(i2)));
+ const int2 x_2 = asint(max(asuint(v2i1), asuint(v2i2)));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.msl
new file mode 100644
index 0000000..63af415
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ int const x_1 = as_type<int>(max(as_type<uint>(i1), as_type<uint>(i2)));
+ int2 const x_2 = as_type<int2>(max(as_type<uint2>(v2i1), as_type<uint2>(v2i2)));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.spvasm
new file mode 100644
index 0000000..8188c0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ %36 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %37 = OpBitcast %uint %int_30
+ %38 = OpBitcast %uint %int_35
+ %35 = OpExtInst %uint %36 UMax %37 %38
+ %34 = OpBitcast %int %35
+ %41 = OpBitcast %v2uint %22
+ %42 = OpBitcast %v2uint %23
+ %40 = OpExtInst %v2uint %36 UMax %41 %42
+ %39 = OpBitcast %v2int %40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.wgsl
new file mode 100644
index 0000000..dfc2521
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : i32 = bitcast<i32>(max(bitcast<u32>(i1), bitcast<u32>(i2)));
+ let x_2 : vec2<i32> = bitcast<vec2<i32>>(max(bitcast<vec2<u32>>(v2i1), bitcast<vec2<u32>>(v2i2)));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm
new file mode 100644
index 0000000..cf942f6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm
@@ -0,0 +1,93 @@
+; Test: SpvParserTest_RectifyOperandsAndResult_UMin.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%3 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %u2 "u2"
+OpName %u3 "u3"
+OpName %i1 "i1"
+OpName %i2 "i2"
+OpName %i3 "i3"
+OpName %f1 "f1"
+OpName %f2 "f2"
+OpName %f3 "f3"
+OpName %v2u1 "v2u1"
+OpName %v2u2 "v2u2"
+OpName %v2u3 "v2u3"
+OpName %v2i1 "v2i1"
+OpName %v2i2 "v2i2"
+OpName %v2i3 "v2i3"
+OpName %v2f1 "v2f1"
+OpName %v2f2 "v2f2"
+OpName %v2f3 "v2f3"
+OpName %v3f1 "v3f1"
+OpName %v3f2 "v3f2"
+OpName %v4f1 "v4f1"
+OpName %v4f2 "v4f2"
+%void = OpTypeVoid
+%27 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_15 = OpConstant %uint 15
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_35 = OpConstant %int 35
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%v4float = OpTypeVector %float 4
+%45 = OpConstantComposite %v2uint %uint_10 %uint_20
+%46 = OpConstantComposite %v2uint %uint_20 %uint_10
+%47 = OpConstantComposite %v2uint %uint_15 %uint_15
+%48 = OpConstantComposite %v2int %int_30 %int_40
+%49 = OpConstantComposite %v2int %int_40 %int_30
+%50 = OpConstantComposite %v2int %int_35 %int_35
+%51 = OpConstantComposite %v2float %float_50 %float_60
+%52 = OpConstantComposite %v2float %float_60 %float_50
+%53 = OpConstantComposite %v2float %float_70 %float_70
+%54 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%55 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%56 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+%100 = OpFunction %void None %27
+%57 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%u2 = OpCopyObject %uint %uint_15
+%u3 = OpCopyObject %uint %uint_20
+%i1 = OpCopyObject %int %int_30
+%i2 = OpCopyObject %int %int_35
+%i3 = OpCopyObject %int %int_40
+%f1 = OpCopyObject %float %float_50
+%f2 = OpCopyObject %float %float_60
+%f3 = OpCopyObject %float %float_70
+%v2u1 = OpCopyObject %v2uint %45
+%v2u2 = OpCopyObject %v2uint %46
+%v2u3 = OpCopyObject %v2uint %47
+%v2i1 = OpCopyObject %v2int %48
+%v2i2 = OpCopyObject %v2int %49
+%v2i3 = OpCopyObject %v2int %50
+%v2f1 = OpCopyObject %v2float %51
+%v2f2 = OpCopyObject %v2float %52
+%v2f3 = OpCopyObject %v2float %53
+%v3f1 = OpCopyObject %v3float %54
+%v3f2 = OpCopyObject %v3float %55
+%v4f1 = OpCopyObject %v4float %56
+%v4f2 = OpCopyObject %v4float %v4f1
+%1 = OpExtInst %int %3 UMin %i1 %i2
+%2 = OpExtInst %v2int %3 UMin %v2i1 %v2i2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.hlsl
new file mode 100644
index 0000000..f01d594
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.hlsl
@@ -0,0 +1,33 @@
+void main_1() {
+ const uint u1 = 10u;
+ const uint u2 = 15u;
+ const uint u3 = 20u;
+ const int i1 = 30;
+ const int i2 = 35;
+ const int i3 = 40;
+ const float f1 = 50.0f;
+ const float f2 = 60.0f;
+ const float f3 = 70.0f;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const uint2 v2u2 = uint2(20u, 10u);
+ const uint2 v2u3 = uint2(15u, 15u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 v2i2 = int2(40, 30);
+ const int2 v2i3 = int2(35, 35);
+ const float2 v2f1 = float2(50.0f, 60.0f);
+ const float2 v2f2 = float2(60.0f, 50.0f);
+ const float2 v2f3 = float2(70.0f, 70.0f);
+ const float3 v3f1 = float3(50.0f, 60.0f, 70.0f);
+ const float3 v3f2 = float3(60.0f, 70.0f, 50.0f);
+ const float4 v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ const float4 v4f2 = v4f1;
+ const int x_1 = asint(min(asuint(i1), asuint(i2)));
+ const int2 x_2 = asint(min(asuint(v2i1), asuint(v2i2)));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.msl
new file mode 100644
index 0000000..f0705ea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ uint const u2 = 15u;
+ uint const u3 = 20u;
+ int const i1 = 30;
+ int const i2 = 35;
+ int const i3 = 40;
+ float const f1 = 50.0f;
+ float const f2 = 60.0f;
+ float const f3 = 70.0f;
+ uint2 const v2u1 = uint2(10u, 20u);
+ uint2 const v2u2 = uint2(20u, 10u);
+ uint2 const v2u3 = uint2(15u, 15u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const v2i2 = int2(40, 30);
+ int2 const v2i3 = int2(35, 35);
+ float2 const v2f1 = float2(50.0f, 60.0f);
+ float2 const v2f2 = float2(60.0f, 50.0f);
+ float2 const v2f3 = float2(70.0f, 70.0f);
+ float3 const v3f1 = float3(50.0f, 60.0f, 70.0f);
+ float3 const v3f2 = float3(60.0f, 70.0f, 50.0f);
+ float4 const v4f1 = float4(50.0f, 50.0f, 50.0f, 50.0f);
+ float4 const v4f2 = v4f1;
+ int const x_1 = as_type<int>(min(as_type<uint>(i1), as_type<uint>(i2)));
+ int2 const x_2 = as_type<int2>(min(as_type<uint2>(v2i1), as_type<uint2>(v2i2)));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.spvasm
new file mode 100644
index 0000000..98a38f6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ %36 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_15 = OpConstant %uint 15
+ %uint_20 = OpConstant %uint 20
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_35 = OpConstant %int 35
+ %int_40 = OpConstant %int 40
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %19 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %20 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantComposite %v2int %int_30 %int_40
+ %23 = OpConstantComposite %v2int %int_40 %int_30
+ %24 = OpConstantComposite %v2int %int_35 %int_35
+ %v2float = OpTypeVector %float 2
+ %26 = OpConstantComposite %v2float %float_50 %float_60
+ %27 = OpConstantComposite %v2float %float_60 %float_50
+ %28 = OpConstantComposite %v2float %float_70 %float_70
+ %v3float = OpTypeVector %float 3
+ %30 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %31 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %v4float = OpTypeVector %float 4
+ %33 = OpConstantComposite %v4float %float_50 %float_50 %float_50 %float_50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %37 = OpBitcast %uint %int_30
+ %38 = OpBitcast %uint %int_35
+ %35 = OpExtInst %uint %36 UMin %37 %38
+ %34 = OpBitcast %int %35
+ %41 = OpBitcast %v2uint %22
+ %42 = OpBitcast %v2uint %23
+ %40 = OpExtInst %v2uint %36 UMin %41 %42
+ %39 = OpBitcast %v2int %40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.wgsl
new file mode 100644
index 0000000..2f6410a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.wgsl
@@ -0,0 +1,32 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let u2 : u32 = 15u;
+ let u3 : u32 = 20u;
+ let i1 : i32 = 30;
+ let i2 : i32 = 35;
+ let i3 : i32 = 40;
+ let f1 : f32 = 50.0;
+ let f2 : f32 = 60.0;
+ let f3 : f32 = 70.0;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2u2 : vec2<u32> = vec2<u32>(20u, 10u);
+ let v2u3 : vec2<u32> = vec2<u32>(15u, 15u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let v2i2 : vec2<i32> = vec2<i32>(40, 30);
+ let v2i3 : vec2<i32> = vec2<i32>(35, 35);
+ let v2f1 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let v2f2 : vec2<f32> = vec2<f32>(60.0, 50.0);
+ let v2f3 : vec2<f32> = vec2<f32>(70.0, 70.0);
+ let v3f1 : vec3<f32> = vec3<f32>(50.0, 60.0, 70.0);
+ let v3f2 : vec3<f32> = vec3<f32>(60.0, 70.0, 50.0);
+ let v4f1 : vec4<f32> = vec4<f32>(50.0, 50.0, 50.0, 50.0);
+ let v4f2 : vec4<f32> = v4f1;
+ let x_1 : i32 = bitcast<i32>(min(bitcast<u32>(i1), bitcast<u32>(i2)));
+ let x_2 : vec2<i32> = bitcast<vec2<i32>>(min(bitcast<vec2<u32>>(v2i1), bitcast<vec2<u32>>(v2i2)));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..0a1f523
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSDiv %int %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..defa908
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 / asint(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..e5ac158
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 / as_type<int>(10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..b13347e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_10
+ %10 = OpSDiv %int %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..58c4800
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 / bitcast<i32>(10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..cc28604
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSDiv %int %uint_10 %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..63478a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (asint(10u) / 30);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..ec582b5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (as_type<int>(10u) / 30);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..40e86f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %int %uint_10
+ %10 = OpSDiv %int %5 %int_30
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..b516923
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (bitcast<i32>(10u) / 30);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..0ded8d4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSDiv %v2int %21 %23
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..d2f1861
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (asint(uint2(10u, 20u)) / int2(30, 40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..a4cca6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (as_type<int2>(uint2(10u, 20u)) / int2(30, 40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..0cb0fff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %15 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %v2int %12
+ %16 = OpSDiv %v2int %5 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..a83a6d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (bitcast<vec2<i32>>(vec2<u32>(10u, 20u)) / vec2<i32>(30, 40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..1252c4b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSDiv %v2int %23 %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..7979a9b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(30, 40) / asint(uint2(10u, 20u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..451cfad
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(30, 40) / as_type<int2>(uint2(10u, 20u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..412e08b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %15 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2int %15
+ %16 = OpSDiv %v2int %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..55f7129
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(30, 40) / bitcast<vec2<i32>>(vec2<u32>(10u, 20u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..ae6e5fe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSDiv %int %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..5179e09
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 / 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..daabff4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 / 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..9c9ba2b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpSDiv %int %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..b3f732f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 / 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..c29f46f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSDiv %v2int %23 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..2fc0a32
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(30, 40) / int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..8aa7b14
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(30, 40) / int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..42b241b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpSDiv %v2int %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..04fc1d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(30, 40) / vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..4f48175
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSGreaterThanEqual %bool %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..8b818ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (30 >= 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..b48d94a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (30 >= 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..4c3dbf8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpSGreaterThanEqual %bool %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..d9c02fd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (30 >= 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..600ce00
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSGreaterThanEqual %bool %uint_10 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..ada89cf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (asint(10u) >= 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..d35ed70
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (as_type<int>(10u) >= 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..4ead06b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %int %uint_10
+ %10 = OpSGreaterThanEqual %bool %5 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..51fa4f9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (bitcast<i32>(10u) >= 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..fd9e1b6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSGreaterThanEqual %bool %int_30 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..9d6c8de
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (30 >= asint(20u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..b598067
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (30 >= as_type<int>(20u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..bcf5de9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_20
+ %10 = OpSGreaterThanEqual %bool %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..804ed03
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (30 >= bitcast<i32>(20u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..4f21ba7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSGreaterThanEqual %v2bool %27 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..e32aea7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (int2(30, 40) >= int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..ec751ec
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (int2(30, 40) >= int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..9a475a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpSGreaterThanEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..dafbd49
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<i32>(30, 40) >= vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..9f0fe82
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSGreaterThanEqual %v2bool %25 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..7666b7d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (asint(uint2(10u, 20u)) >= int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..932cbe8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (as_type<int2>(uint2(10u, 20u)) >= int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..fd8bab8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %15 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %v2int %12
+ %16 = OpSGreaterThanEqual %v2bool %5 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..0352cfc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (bitcast<vec2<i32>>(vec2<u32>(10u, 20u)) >= vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..5dd2483
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSGreaterThanEqual %v2bool %27 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..f74a2cc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (int2(30, 40) >= asint(uint2(20u, 10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..17b0609
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (int2(30, 40) >= as_type<int2>(uint2(20u, 10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..577be19
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %15 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2int %15
+ %16 = OpSGreaterThanEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..02da6b0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<i32>(30, 40) >= bitcast<vec2<i32>>(vec2<u32>(20u, 10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..f12d052
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSGreaterThan %bool %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..5605d58
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (30 > 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..162e06b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (30 > 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..bf38d33
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpSGreaterThan %bool %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..895ed77
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (30 > 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..d9718bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSGreaterThan %bool %uint_10 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..e6c107b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (asint(10u) > 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..d888be9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (as_type<int>(10u) > 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..1e38c38
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %int %uint_10
+ %10 = OpSGreaterThan %bool %5 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..a7094f2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (bitcast<i32>(10u) > 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..197a654
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSGreaterThan %bool %int_30 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..cb82baf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (30 > asint(20u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..be5e68b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (30 > as_type<int>(20u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..b14b893
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_20
+ %10 = OpSGreaterThan %bool %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..105fab9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (30 > bitcast<i32>(20u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..15eba45
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSGreaterThan %v2bool %27 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..87fae0e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (int2(30, 40) > int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..cf4ad4a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (int2(30, 40) > int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..5dfcaf9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpSGreaterThan %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..9f59d59
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<i32>(30, 40) > vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..11d301f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSGreaterThan %v2bool %25 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..8650924
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (asint(uint2(10u, 20u)) > int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..f30a5d5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (as_type<int2>(uint2(10u, 20u)) > int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..7a2e86e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %15 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %v2int %12
+ %16 = OpSGreaterThan %v2bool %5 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..2680fb4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (bitcast<vec2<i32>>(vec2<u32>(10u, 20u)) > vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..10ecb3c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSGreaterThan %v2bool %27 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..6fedeac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (int2(30, 40) > asint(uint2(20u, 10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..532d559
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (int2(30, 40) > as_type<int2>(uint2(20u, 10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..db2ed4f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %15 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2int %15
+ %16 = OpSGreaterThan %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..2ad66c5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<i32>(30, 40) > bitcast<vec2<i32>>(vec2<u32>(20u, 10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..739fae9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSLessThanEqual %bool %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..bcfbc55
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (30 <= 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..b5e0e61
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (30 <= 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..182d1ed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpSLessThanEqual %bool %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..e583996
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (30 <= 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..1887106
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSLessThanEqual %bool %uint_10 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..3f403d7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (asint(10u) <= 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..a845fcb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (as_type<int>(10u) <= 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..4f210d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %int %uint_10
+ %10 = OpSLessThanEqual %bool %5 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..e6eea97
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (bitcast<i32>(10u) <= 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..8e2a38b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSLessThanEqual %bool %int_30 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..8494aef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (30 <= asint(20u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..76d5435
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (30 <= as_type<int>(20u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..bda3489
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_20
+ %10 = OpSLessThanEqual %bool %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..6aa2915
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (30 <= bitcast<i32>(20u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..3d37102
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSLessThanEqual %v2bool %27 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..5b5e70c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (int2(30, 40) <= int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..1966829
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (int2(30, 40) <= int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..507bff3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpSLessThanEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..fbd80c7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<i32>(30, 40) <= vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..d41cb8d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSLessThanEqual %v2bool %25 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..6d9da8a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (asint(uint2(10u, 20u)) <= int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..1b10334
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (as_type<int2>(uint2(10u, 20u)) <= int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..4138a0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %15 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %v2int %12
+ %16 = OpSLessThanEqual %v2bool %5 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..5593a3b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (bitcast<vec2<i32>>(vec2<u32>(10u, 20u)) <= vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..b7f0394
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSLessThanEqual %v2bool %27 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..ea43b6b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (int2(30, 40) <= asint(uint2(20u, 10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..0af2432
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (int2(30, 40) <= as_type<int2>(uint2(20u, 10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..9bcc136
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %15 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2int %15
+ %16 = OpSLessThanEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..0e1cb7f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<i32>(30, 40) <= bitcast<vec2<i32>>(vec2<u32>(20u, 10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..d35bc5a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSLessThan %bool %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..ead1e5e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (30 < 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..7e80f5d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (30 < 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..278b5c5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpSLessThan %bool %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..11b0642
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (30 < 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..0fe3cf6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSLessThan %bool %uint_10 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..45b3aeb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (asint(10u) < 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..b16d09f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (as_type<int>(10u) < 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..781f412
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %int %uint_10
+ %10 = OpSLessThan %bool %5 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..a9497dd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (bitcast<i32>(10u) < 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..8fbc298
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSLessThan %bool %int_30 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..a040e74
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (30 < asint(20u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..1042dba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (30 < as_type<int>(20u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..d388618
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_20
+ %10 = OpSLessThan %bool %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..f078b97
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (30 < bitcast<i32>(20u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..65a0bb8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSLessThan %v2bool %27 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..12d6f0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (int2(30, 40) < int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..e6def40
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (int2(30, 40) < int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..efb9643
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpSLessThan %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..3664a2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<i32>(30, 40) < vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..3268fd9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSLessThan %v2bool %25 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..a8908da
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (asint(uint2(10u, 20u)) < int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..ec554e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (as_type<int2>(uint2(10u, 20u)) < int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..8163531
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %15 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %v2int %12
+ %16 = OpSLessThan %v2bool %5 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..118474d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (bitcast<vec2<i32>>(vec2<u32>(10u, 20u)) < vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..6a8dcf5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpSLessThan %v2bool %27 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..cbc9245
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (int2(30, 40) < asint(uint2(20u, 10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..cc17d4a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (int2(30, 40) < as_type<int2>(uint2(20u, 10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..6c1b619
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %15 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2int %15
+ %16 = OpSLessThan %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..a26f77d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<i32>(30, 40) < bitcast<vec2<i32>>(vec2<u32>(20u, 10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..21f4aed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSMod %int %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..d748005
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 % asint(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..55517d6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 % as_type<int>(10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..bd60d09
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_10
+ %10 = OpSMod %int %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..8f02084
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 % bitcast<i32>(10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..7eb5ec9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSMod %int %uint_10 %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..63e176f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (asint(10u) % 30);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..c3a9181
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (as_type<int>(10u) % 30);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..e86a863
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %int %uint_10
+ %10 = OpSMod %int %5 %int_30
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..b34b87b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (bitcast<i32>(10u) % 30);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..0f6693c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSMod %v2int %21 %23
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..5883bd9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (asint(uint2(10u, 20u)) % int2(30, 40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..75cd027
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (as_type<int2>(uint2(10u, 20u)) % int2(30, 40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..288a9ba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %15 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %v2int %12
+ %16 = OpSMod %v2int %5 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..d1bd49d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (bitcast<vec2<i32>>(vec2<u32>(10u, 20u)) % vec2<i32>(30, 40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..f8fb92d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSMod %v2int %23 %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..d7adb8e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(30, 40) % asint(uint2(10u, 20u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..89b5627
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(30, 40) % as_type<int2>(uint2(10u, 20u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..84a80e3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %15 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2int %15
+ %16 = OpSMod %v2int %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..115838f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(30, 40) % bitcast<vec2<i32>>(vec2<u32>(10u, 20u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..fa9be0c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSMod %int %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..be2c6ae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 % 40);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..4d6bc47
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 % 40);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..8ab36ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpSMod %int %int_30 %int_40
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..88c4d00
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 % 40);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..1beca7f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSMod %v2int %23 %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..3b023f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(30, 40) % int2(40, 30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..3808cd9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(30, 40) % int2(40, 30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..59b9622
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %10 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpSMod %v2int %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..9fff949
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(30, 40) % vec2<i32>(40, 30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..29dc1c6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftLeftLogical %int %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..da4c40a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 << asuint(40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..9d37405
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 << as_type<uint>(40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..bea7497
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_40
+ %10 = OpShiftLeftLogical %int %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..f9c9c0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 << bitcast<u32>(40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..39935a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftLeftLogical %uint %uint_10 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..bb09952
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u << asuint(40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..daa90a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u << as_type<uint>(40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..34f6aac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_40
+ %10 = OpShiftLeftLogical %uint %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..c21ba25
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u << bitcast<u32>(40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..2627343
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftLeftLogical %v2uint %19 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..3298030
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (uint2(10u, 20u) << uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..f585f56
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = (uint2(10u, 20u) << uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..35025bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpShiftLeftLogical %v2uint %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..2f07877
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = (vec2<u32>(10u, 20u) << vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..d93a17f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftLeftLogical %v2int %21 %22
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..50533a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(30, 40) << asuint(int2(40, 30)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..92b03c4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(30, 40) << as_type<uint2>(int2(40, 30)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..7f96e9d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %13 = OpConstantComposite %v2int %int_40 %int_30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2uint %13
+ %14 = OpShiftLeftLogical %v2int %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..a9e670d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(30, 40) << bitcast<vec2<u32>>(vec2<i32>(40, 30)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..00c911b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftLeftLogical %uint %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..522b2a9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u << 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..59a5762
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u << 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..e492467
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpShiftLeftLogical %uint %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..b7d926a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u << 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..1e3b356
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftLeftLogical %int %int_30 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..684e4bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 << 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..868ba01
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 << 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..50df6f9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpShiftLeftLogical %int %int_30 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..8861845
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 << 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..35f4a5b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftLeftLogical %v2uint %19 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..3298030
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (uint2(10u, 20u) << uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..f585f56
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = (uint2(10u, 20u) << uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..35025bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpShiftLeftLogical %v2uint %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..2f07877
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = (vec2<u32>(10u, 20u) << vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..66b9237
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftLeftLogical %v2int %21 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..7dfc099
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(30, 40) << uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..f600d43
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(30, 40) << uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..98a3f34
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %14 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %15 = OpShiftLeftLogical %v2int %9 %14
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..bfa4807
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(30, 40) << vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..e30a334
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftLeftLogical %uint %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..e6cfa85
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint((30 << 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..cee2583
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>((30 << 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..b038d38
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpShiftLeftLogical %int %int_30 %uint_10
+ %5 = OpBitcast %uint %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..244c276
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>((30 << 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..7b86de0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftLeftLogical %v2uint %21 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..ae6e093
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint((int2(30, 40) << uint2(20u, 10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..1fca25d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>((int2(30, 40) << uint2(20u, 10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..9449517
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %15 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %16 = OpShiftLeftLogical %v2int %12 %15
+ %5 = OpBitcast %v2uint %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..a85aabc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30, 40) << vec2<u32>(20u, 10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..fa38fa0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightArithmetic %uint %uint_10 %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..aa6d2b6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint((asint(10u) >> asuint(30)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..6d7d9b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>((as_type<int>(10u) >> as_type<uint>(30)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..abac46a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %uint_10 = OpConstant %uint 10
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_10
+ %10 = OpBitcast %uint %int_30
+ %12 = OpShiftRightArithmetic %int %7 %10
+ %5 = OpBitcast %uint %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..b9dfa9a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>((bitcast<i32>(10u) >> bitcast<u32>(30)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..4d9941f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightArithmetic %int %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..1f3d8f5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 >> asuint(40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..c18e6c1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 >> as_type<uint>(40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..7e7dc5d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_40
+ %10 = OpShiftRightArithmetic %int %int_30 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..12b8f3c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 >> bitcast<u32>(40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..d9346ee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightArithmetic %v2uint %19 %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..254af38
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint((asint(uint2(10u, 20u)) >> asuint(int2(30, 40))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..28def88
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>((as_type<int2>(uint2(10u, 20u)) >> as_type<uint2>(int2(30, 40))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..1e63192
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %13 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %17 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpBitcast %v2int %13
+ %14 = OpBitcast %v2uint %17
+ %18 = OpShiftRightArithmetic %v2int %8 %14
+ %5 = OpBitcast %v2uint %18
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..1c0238a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>((bitcast<vec2<i32>>(vec2<u32>(10u, 20u)) >> bitcast<vec2<u32>>(vec2<i32>(30, 40))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..15d9239
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightArithmetic %v2int %22 %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..2627d37
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(40, 30) >> asuint(int2(30, 40)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..eb98703
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(40, 30) >> as_type<uint2>(int2(30, 40)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..069612b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %9 = OpConstantComposite %v2int %int_40 %int_30
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %13 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2uint %13
+ %14 = OpShiftRightArithmetic %v2int %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..d38f1fc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(40, 30) >> bitcast<vec2<u32>>(vec2<i32>(30, 40)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..0b11836
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightArithmetic %uint %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..4221afa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint((asint(10u) >> 20u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..eb4dbee
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>((as_type<int>(10u) >> 20u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..dc1f007
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %int %uint_10
+ %11 = OpShiftRightArithmetic %int %7 %uint_20
+ %5 = OpBitcast %uint %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..5e1b625
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>((bitcast<i32>(10u) >> 20u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..3e438fe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightArithmetic %int %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..d7265d3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = (30 >> 10u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..380a4a7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = (30 >> 10u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..2653c8c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpShiftRightArithmetic %int %int_30 %uint_10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..057af01
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = (30 >> 10u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..a3ac94f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightArithmetic %v2uint %19 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..971b55b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint((asint(uint2(10u, 20u)) >> uint2(20u, 10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..a193e22
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>((as_type<int2>(uint2(10u, 20u)) >> uint2(20u, 10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..8b7e238
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %13 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %14 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpBitcast %v2int %13
+ %15 = OpShiftRightArithmetic %v2int %8 %14
+ %5 = OpBitcast %v2uint %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..ae84fd1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>((bitcast<vec2<i32>>(vec2<u32>(10u, 20u)) >> vec2<u32>(20u, 10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..63b9437
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightArithmetic %v2int %22 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..4cfc73b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = (int2(40, 30) >> uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..45f1424
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = (int2(40, 30) >> uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..a471451
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %9 = OpConstantComposite %v2int %int_40 %int_30
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %14 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %15 = OpShiftRightArithmetic %v2int %9 %14
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..84ea2b5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = (vec2<i32>(40, 30) >> vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..dc1e7a9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightArithmetic %uint %int_30 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..ec77cf8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint((30 >> 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..33ceeba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>((30 >> 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..d1fc418
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpShiftRightArithmetic %int %int_30 %uint_10
+ %5 = OpBitcast %uint %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..23cb77e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>((30 >> 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..0d6213e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightArithmetic %v2uint %21 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..c5ef155
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint((int2(30, 40) >> uint2(20u, 10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..97283a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>((int2(30, 40) >> uint2(20u, 10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..e6af6ba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %15 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %16 = OpShiftRightArithmetic %v2int %12 %15
+ %5 = OpBitcast %v2uint %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..c37f278
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>((vec2<i32>(30, 40) >> vec2<u32>(20u, 10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..c576fbb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightLogical %uint %uint_10 %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..a089bba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u >> asuint(30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..e4ef80b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u >> as_type<uint>(30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..cc52d64
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_30
+ %10 = OpShiftRightLogical %uint %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..2334466
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u >> bitcast<u32>(30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..9d01d7c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightLogical %int %int_30 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..7764fc7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = asint((asuint(30) >> asuint(40)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..1cf94f6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = as_type<int>((as_type<uint>(30) >> as_type<uint>(40)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..26de32f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_30
+ %10 = OpBitcast %uint %int_40
+ %12 = OpShiftRightLogical %uint %7 %10
+ %5 = OpBitcast %int %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..dcfcc28
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = bitcast<i32>((bitcast<u32>(30) >> bitcast<u32>(40)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..caa32f3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightLogical %v2uint %19 %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..fccd02b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (uint2(10u, 20u) >> asuint(int2(30, 40)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..bea342c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = (uint2(10u, 20u) >> as_type<uint2>(int2(30, 40)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..a160b65
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %15 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2uint %15
+ %16 = OpShiftRightLogical %v2uint %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..236e312
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = (vec2<u32>(10u, 20u) >> bitcast<vec2<u32>>(vec2<i32>(30, 40)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..36152e1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightLogical %v2int %22 %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..1781994
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = asint((asuint(int2(40, 30)) >> asuint(int2(30, 40))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..496df37
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = as_type<int2>((as_type<uint2>(int2(40, 30)) >> as_type<uint2>(int2(30, 40))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..adc4f06
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %13 = OpConstantComposite %v2int %int_40 %int_30
+ %15 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpBitcast %v2uint %13
+ %14 = OpBitcast %v2uint %15
+ %16 = OpShiftRightLogical %v2uint %8 %14
+ %5 = OpBitcast %v2int %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..d210ae2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = bitcast<vec2<i32>>((bitcast<vec2<u32>>(vec2<i32>(40, 30)) >> bitcast<vec2<u32>>(vec2<i32>(30, 40))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..bb84015
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightLogical %uint %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..fe69c41
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u >> 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..b9f45a4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u >> 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..2ff1d3d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpShiftRightLogical %uint %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..dcce358
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u >> 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..cb76e4e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightLogical %int %int_30 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..cce77bf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = asint((asuint(30) >> 20u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..fe03581
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = as_type<int>((as_type<uint>(30) >> 20u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..bae8ebb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %int_30 = OpConstant %int 30
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_30
+ %11 = OpShiftRightLogical %uint %7 %uint_20
+ %5 = OpBitcast %int %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..d946dd9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = bitcast<i32>((bitcast<u32>(30) >> 20u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..64fb2d0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightLogical %v2uint %19 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..e14739a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (uint2(10u, 20u) >> uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..15ddfb1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = (uint2(10u, 20u) >> uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..14d913c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpShiftRightLogical %v2uint %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..d943102
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = (vec2<u32>(10u, 20u) >> vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..d62644a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightLogical %v2int %21 %19
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..33234e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = asint((asuint(int2(30, 40)) >> uint2(10u, 20u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..89ed12c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = as_type<int2>((as_type<uint2>(int2(30, 40)) >> uint2(10u, 20u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..6cada59
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %13 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %16 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpBitcast %v2uint %13
+ %17 = OpShiftRightLogical %v2uint %8 %16
+ %5 = OpBitcast %v2int %17
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..57706fe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = bitcast<vec2<i32>>((bitcast<vec2<u32>>(vec2<i32>(30, 40)) >> vec2<u32>(10u, 20u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..e1fc09d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightLogical %int %uint_20 %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..6d3a42e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = asint((20u >> 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..b434eea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = as_type<int>((20u >> 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..4793ea0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpShiftRightLogical %uint %uint_20 %uint_10
+ %5 = OpBitcast %int %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..debcad5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = bitcast<i32>((20u >> 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..3680478
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpShiftRightLogical %v2int %19 %20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..2ac568f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = asint((uint2(10u, 20u) >> uint2(20u, 10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..1f77cfb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = as_type<int2>((uint2(10u, 20u) >> uint2(20u, 10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..68f9a1d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %13 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %14 = OpShiftRightLogical %v2uint %12 %13
+ %5 = OpBitcast %v2int %14
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..6a821a6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = bitcast<vec2<i32>>((vec2<u32>(10u, 20u) >> vec2<u32>(20u, 10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..ebe4ed5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpUDiv %uint %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..f1d2dd7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u / 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..788d389
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u / 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..6dac704
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpUDiv %uint %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..a211969
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u / 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..b5332df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpUDiv %v2uint %21 %22
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..ec26f7f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (uint2(10u, 20u) / uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..9adf36c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = (uint2(10u, 20u) / uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..7f0bf43
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpUDiv %v2uint %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..572afb7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = (vec2<u32>(10u, 20u) / vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..228eaab
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpUGreaterThanEqual %bool %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..269dbdc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (10u >= 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..79726d6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (10u >= 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..ea7e086
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpUGreaterThanEqual %bool %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..d1568cc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (10u >= 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..5dcb6ed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpUGreaterThanEqual %bool %int_30 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..101a663
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (asuint(30) >= 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..4c3627a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (as_type<uint>(30) >= 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..3a28cbf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %uint %int_30
+ %10 = OpUGreaterThanEqual %bool %5 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..6f61fad
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (bitcast<u32>(30) >= 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..a371aa8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpUGreaterThanEqual %bool %uint_10 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..eaab66f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (10u >= asuint(40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..a860f02
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (10u >= as_type<uint>(40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..3aa9633
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_40
+ %10 = OpUGreaterThanEqual %bool %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..6a48097
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (10u >= bitcast<u32>(40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..fab3410
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpUGreaterThanEqual %v2bool %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..18bea18
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (uint2(10u, 20u) >= uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..caaa4c0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (uint2(10u, 20u) >= uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..2dda07d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpUGreaterThanEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..484b06f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<u32>(10u, 20u) >= vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..2451a41
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpUGreaterThanEqual %v2bool %27 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..50cb12f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (asuint(int2(30, 40)) >= uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..29ebb85
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (as_type<uint2>(int2(30, 40)) >= uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..85c6ef1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %15 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %v2uint %12
+ %16 = OpUGreaterThanEqual %v2bool %5 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..b5c1d5d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (bitcast<vec2<u32>>(vec2<i32>(30, 40)) >= vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..3912b29
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpUGreaterThanEqual %v2bool %25 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..569fa4d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (uint2(10u, 20u) >= asuint(int2(40, 30)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..e83f2e9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (uint2(10u, 20u) >= as_type<uint2>(int2(40, 30)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..62f78c7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %15 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2uint %15
+ %16 = OpUGreaterThanEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..e22ecaa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<u32>(10u, 20u) >= bitcast<vec2<u32>>(vec2<i32>(40, 30)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..2b56077
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpUGreaterThan %bool %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..395694e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (10u > 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..f92a651
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (10u > 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..4ffd4ad
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpUGreaterThan %bool %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..ba1b933
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (10u > 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..1d1350d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpUGreaterThan %bool %int_30 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..616c20b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (asuint(30) > 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..ca095b2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (as_type<uint>(30) > 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..c5a189b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %uint %int_30
+ %10 = OpUGreaterThan %bool %5 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..5b62486
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (bitcast<u32>(30) > 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..64aaaac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpUGreaterThan %bool %uint_10 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..e01e8e3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (10u > asuint(40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..cdd8212
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (10u > as_type<uint>(40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..c2611bc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_40
+ %10 = OpUGreaterThan %bool %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..52b4915
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (10u > bitcast<u32>(40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..5d538a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpUGreaterThan %v2bool %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..22ada31
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (uint2(10u, 20u) > uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..98af048
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (uint2(10u, 20u) > uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..1ab95a8b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpUGreaterThan %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..fb41332
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<u32>(10u, 20u) > vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..20ca9be
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpUGreaterThan %v2bool %27 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..611e248
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (asuint(int2(30, 40)) > uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..6aebfa0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (as_type<uint2>(int2(30, 40)) > uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..2b177eb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %15 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %v2uint %12
+ %16 = OpUGreaterThan %v2bool %5 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..33324fc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (bitcast<vec2<u32>>(vec2<i32>(30, 40)) > vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..cf2b03a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpUGreaterThan %v2bool %25 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..99e15f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (uint2(10u, 20u) > asuint(int2(40, 30)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..fac467f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (uint2(10u, 20u) > as_type<uint2>(int2(40, 30)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..c13dfc6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %15 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2uint %15
+ %16 = OpUGreaterThan %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..726a9cb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<u32>(10u, 20u) > bitcast<vec2<u32>>(vec2<i32>(40, 30)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..b6eadb0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpULessThanEqual %bool %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..b4b48a8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (10u <= 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..565f43e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (10u <= 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..c9fd16c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpULessThanEqual %bool %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..4ca1576
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (10u <= 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..d1d4095
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpULessThanEqual %bool %int_30 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..ebaa675
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (asuint(30) <= 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..0449677
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (as_type<uint>(30) <= 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..4d4fc86
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %uint %int_30
+ %10 = OpULessThanEqual %bool %5 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..4bdbb7b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (bitcast<u32>(30) <= 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..c2a3495
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpULessThanEqual %bool %uint_10 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..5134767
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (10u <= asuint(40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..bf2bbad
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (10u <= as_type<uint>(40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..94a4a39
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_40
+ %10 = OpULessThanEqual %bool %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..78fb0eb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (10u <= bitcast<u32>(40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..e237f8a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpULessThanEqual %v2bool %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..aadcc08
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (uint2(10u, 20u) <= uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..603faf2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (uint2(10u, 20u) <= uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..9fb5892
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpULessThanEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..a72937f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<u32>(10u, 20u) <= vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..7ed1e92
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpULessThanEqual %v2bool %27 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..fe3cd84
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (asuint(int2(30, 40)) <= uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..5779984
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (as_type<uint2>(int2(30, 40)) <= uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..44c3f9a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %15 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %v2uint %12
+ %16 = OpULessThanEqual %v2bool %5 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..1a31f7c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (bitcast<vec2<u32>>(vec2<i32>(30, 40)) <= vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..84ae772
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpULessThanEqual %v2bool %25 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..84c03db
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (uint2(10u, 20u) <= asuint(int2(40, 30)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..ec6c1fc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (uint2(10u, 20u) <= as_type<uint2>(int2(40, 30)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..158173a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %15 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2uint %15
+ %16 = OpULessThanEqual %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..0f7d1fe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<u32>(10u, 20u) <= bitcast<vec2<u32>>(vec2<i32>(40, 30)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..0947de5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpULessThan %bool %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..58fdafc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (10u < 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..600fb97
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (10u < 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..f1cdb11
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpULessThan %bool %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..da0007f9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (10u < 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..acf7f4b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpULessThan %bool %int_30 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..88c9a0b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (asuint(30) < 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..56104b5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (as_type<uint>(30) < 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..f441af6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %uint_20 = OpConstant %uint 20
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %uint %int_30
+ %10 = OpULessThan %bool %5 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..d82804a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (bitcast<u32>(30) < 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm
new file mode 100644
index 0000000..651d986
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpULessThan %bool %uint_10 %int_40
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..faa2785
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = (10u < asuint(40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
new file mode 100644
index 0000000..a5f3097
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = (10u < as_type<uint>(40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..b678462
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_40 = OpConstant %int 40
+ %bool = OpTypeBool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpBitcast %uint %int_40
+ %10 = OpULessThan %bool %uint_10 %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..095014f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = (10u < bitcast<u32>(40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm
new file mode 100644
index 0000000..6b128ae
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpULessThan %v2bool %25 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..5a53bda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (uint2(10u, 20u) < uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
new file mode 100644
index 0000000..a1ca897
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (uint2(10u, 20u) < uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..984ef08
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpULessThan %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..c2c2599
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<u32>(10u, 20u) < vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm
new file mode 100644
index 0000000..8801e12
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpULessThan %v2bool %27 %26
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
new file mode 100644
index 0000000..2b6fcf6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (asuint(int2(30, 40)) < uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
new file mode 100644
index 0000000..749f7fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (as_type<uint2>(int2(30, 40)) < uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
new file mode 100644
index 0000000..4cad910
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %12 = OpConstantComposite %v2int %int_30 %int_40
+ %uint_20 = OpConstant %uint 20
+ %uint_10 = OpConstant %uint 10
+ %15 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %v2uint %12
+ %16 = OpULessThan %v2bool %5 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
new file mode 100644
index 0000000..2a91bce
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (bitcast<vec2<u32>>(vec2<i32>(30, 40)) < vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm
new file mode 100644
index 0000000..fa0e3fa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpULessThan %v2bool %25 %28
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
new file mode 100644
index 0000000..bef764d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = (uint2(10u, 20u) < asuint(int2(40, 30)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
new file mode 100644
index 0000000..52e34c4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = (uint2(10u, 20u) < as_type<uint2>(int2(40, 30)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
new file mode 100644
index 0000000..c84e351
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.spvasm
@@ -0,0 +1,36 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %int_30 = OpConstant %int 30
+ %15 = OpConstantComposite %v2int %int_40 %int_30
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpBitcast %v2uint %15
+ %16 = OpULessThan %v2bool %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
new file mode 100644
index 0000000..5039a15
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = (vec2<u32>(10u, 20u) < bitcast<vec2<u32>>(vec2<i32>(40, 30)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm
new file mode 100644
index 0000000..c41f03e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpUMod %uint %uint_10 %uint_20
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..c02baaf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = (10u % 20u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
new file mode 100644
index 0000000..f5eaa38
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = (10u % 20u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..fcc8b64
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpUMod %uint %uint_10 %uint_20
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..5c6fcbb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = (10u % 20u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm
new file mode 100644
index 0000000..7ca3f9d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpUMod %v2uint %21 %22
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..31e7210
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = (uint2(10u, 20u) % uint2(20u, 10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
new file mode 100644
index 0000000..7cbfbb8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = (uint2(10u, 20u) % uint2(20u, 10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..7595701
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.spvasm
@@ -0,0 +1,29 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 15
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %10 = OpConstantComposite %v2uint %uint_20 %uint_10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpUMod %v2uint %9 %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %13 = OpLabel
+ %14 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..d623487
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = (vec2<u32>(10u, 20u) % vec2<u32>(20u, 10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm b/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm
new file mode 100644
index 0000000..89d5db4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm
@@ -0,0 +1,43 @@
+; Test: SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 501
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%float_42 = OpConstant %float 42
+%13 = OpUndef %bool
+%100 = OpFunction %void None %2
+%10 = OpLabel
+OpBranch %30
+%20 = OpLabel
+%499 = OpFAdd %float %float_42 %float_42
+%500 = OpFAdd %float %499 %float_42
+OpBranch %25
+%25 = OpLabel
+OpBranch %80
+%30 = OpLabel
+OpLoopMerge %90 %80 None
+OpBranchConditional %13 %90 %40
+%40 = OpLabel
+OpBranch %90
+%80 = OpLabel
+%81 = OpFMul %float %500 %float_42
+OpBranch %30
+%90 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.hlsl
new file mode 100644
index 0000000..4998500
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.hlsl
@@ -0,0 +1,17 @@
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ }
+ break;
+ {
+ const float x_81 = (0.0f * 42.0f);
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.msl
new file mode 100644
index 0000000..c1a3641
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ if (false) {
+ break;
+ }
+ break;
+ {
+ float const x_81 = (0.0f * 42.0f);
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.spvasm
new file mode 100644
index 0000000..483c563
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.spvasm
@@ -0,0 +1,42 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %false = OpConstantFalse %bool
+ %float = OpTypeFloat 32
+ %float_0 = OpConstant %float 0
+ %float_42 = OpConstant %float 42
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpBranch %5
+ %5 = OpLabel
+ OpLoopMerge %6 %7 None
+ OpBranch %8
+ %8 = OpLabel
+ OpSelectionMerge %11 None
+ OpBranchConditional %false %12 %11
+ %12 = OpLabel
+ OpBranch %6
+ %11 = OpLabel
+ OpBranch %6
+ %7 = OpLabel
+ %16 = OpFMul %float %float_0 %float_42
+ OpBranch %5
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.wgsl
new file mode 100644
index 0000000..5629082
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.wgsl
@@ -0,0 +1,18 @@
+fn main_1() {
+ loop {
+ if (false) {
+ break;
+ }
+ break;
+
+ continuing {
+ let x_81 : f32 = (0.0 * 42.0);
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm
new file mode 100644
index 0000000..49be645
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%26 = OpConstantNull %mat3v2float
+%_struct_27 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%29 = OpConstantComposite %v2uint %uint_3 %uint_4
+%30 = OpConstantComposite %v2uint %uint_4 %uint_3
+%31 = OpConstantComposite %v2float %float_50 %float_60
+%32 = OpConstantComposite %v2float %float_60 %float_50
+%33 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %4
+%34 = OpLabel
+%1 = OpCopyObject %v2uint %29
+%2 = OpCopyObject %int %int_1
+%10 = OpVectorExtractDynamic %uint %1 %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.hlsl
new file mode 100644
index 0000000..5204289
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ const uint2 x_1 = uint2(3u, 4u);
+ const uint x_10 = x_1[1];
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.msl
new file mode 100644
index 0000000..77e55e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ uint2 const x_1 = uint2(3u, 4u);
+ int const x_2 = 1;
+ uint const x_10 = x_1[x_2];
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.spvasm
new file mode 100644
index 0000000..a5b74de
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %9 = OpConstantComposite %v2uint %uint_3 %uint_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %12 = OpVectorExtractDynamic %uint %9 %int_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.wgsl
new file mode 100644
index 0000000..3ba0951
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ let x_1 : vec2<u32> = vec2<u32>(3u, 4u);
+ let x_2 : i32 = 1;
+ let x_10 : u32 = x_1[x_2];
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm
new file mode 100644
index 0000000..30794bf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%26 = OpConstantNull %mat3v2float
+%_struct_27 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%29 = OpConstantComposite %v2uint %uint_3 %uint_4
+%30 = OpConstantComposite %v2uint %uint_4 %uint_3
+%31 = OpConstantComposite %v2float %float_50 %float_60
+%32 = OpConstantComposite %v2float %float_60 %float_50
+%33 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %4
+%34 = OpLabel
+%1 = OpCopyObject %v2uint %29
+%2 = OpCopyObject %uint %uint_3
+%10 = OpVectorExtractDynamic %uint %1 %2
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.hlsl
new file mode 100644
index 0000000..6907154
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ const uint2 x_1 = uint2(3u, 4u);
+ const uint x_10 = x_1[3u];
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.msl
new file mode 100644
index 0000000..2d7efef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ uint2 const x_1 = uint2(3u, 4u);
+ uint const x_2 = 3u;
+ uint const x_10 = x_1[x_2];
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.spvasm
new file mode 100644
index 0000000..c5b37ff
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %9 = OpConstantComposite %v2uint %uint_3 %uint_4
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpVectorExtractDynamic %uint %9 %uint_3
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.wgsl
new file mode 100644
index 0000000..a48d2d8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ let x_1 : vec2<u32> = vec2<u32>(3u, 4u);
+ let x_2 : u32 = 3u;
+ let x_10 : u32 = x_1[x_2];
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm b/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm
new file mode 100644
index 0000000..3ea4c8e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm
@@ -0,0 +1,49 @@
+; Test: SpvParserTest_VectorInsertDynamic_Sample.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%5 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%27 = OpConstantNull %mat3v2float
+%_struct_28 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%30 = OpConstantComposite %v2uint %uint_3 %uint_4
+%31 = OpConstantComposite %v2uint %uint_4 %uint_3
+%32 = OpConstantComposite %v2float %float_50 %float_60
+%33 = OpConstantComposite %v2float %float_60 %float_50
+%34 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %5
+%35 = OpLabel
+%1 = OpCopyObject %v2uint %30
+%2 = OpCopyObject %uint %uint_3
+%3 = OpCopyObject %int %int_1
+%10 = OpVectorInsertDynamic %v2uint %1 %2 %3
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.hlsl
new file mode 100644
index 0000000..1c7138d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.hlsl
@@ -0,0 +1,19 @@
+void set_uint2(inout uint2 vec, int idx, uint val) {
+ vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
+}
+
+void main_1() {
+ const uint2 x_1 = uint2(3u, 4u);
+ const uint x_2 = 3u;
+ const int x_3 = 1;
+ uint2 x_10_1 = x_1;
+ set_uint2(x_10_1, x_3, x_2);
+ const uint2 x_10 = x_10_1;
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.msl
new file mode 100644
index 0000000..431e568
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.msl
@@ -0,0 +1,24 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ uint2 const x_1 = uint2(3u, 4u);
+ uint const x_2 = 3u;
+ int const x_3 = 1;
+ uint2 x_10_1 = x_1;
+ x_10_1[x_3] = x_2;
+ uint2 const x_10 = x_10_1;
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.spvasm
new file mode 100644
index 0000000..dc89859
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.spvasm
@@ -0,0 +1,38 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %x_10_1 "x_10_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %9 = OpConstantComposite %v2uint %uint_3 %uint_4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %14 = OpConstantNull %v2uint
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_10_1 = OpVariable %_ptr_Function_v2uint Function %14
+ OpStore %x_10_1 %9
+ %16 = OpAccessChain %_ptr_Function_uint %x_10_1 %int_1
+ OpStore %16 %uint_3
+ %17 = OpLoad %v2uint %x_10_1
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.wgsl
new file mode 100644
index 0000000..cd22d95
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.wgsl
@@ -0,0 +1,20 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ let x_1 : vec2<u32> = vec2<u32>(3u, 4u);
+ let x_2 : u32 = 3u;
+ let x_3 : i32 = 1;
+ var x_10_1 : vec2<u32> = x_1;
+ x_10_1[x_3] = x_2;
+ let x_10 : vec2<u32> = x_10_1;
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm
new file mode 100644
index 0000000..d185226
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm
@@ -0,0 +1,47 @@
+; Test: SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%25 = OpConstantNull %mat3v2float
+%_struct_26 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%28 = OpConstantComposite %v2uint %uint_3 %uint_4
+%29 = OpConstantComposite %v2uint %uint_4 %uint_3
+%30 = OpConstantComposite %v2float %float_50 %float_60
+%31 = OpConstantComposite %v2float %float_60 %float_50
+%32 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %3
+%33 = OpLabel
+%1 = OpCopyObject %v2uint %29
+%10 = OpVectorShuffle %v2uint %1 %1 4294967295 1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.hlsl
new file mode 100644
index 0000000..d4440e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.hlsl
@@ -0,0 +1,11 @@
+void main_1() {
+ const uint2 x_1 = uint2(4u, 3u);
+ const uint2 x_10 = uint2(0u, x_1.y);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.msl
new file mode 100644
index 0000000..f67f345
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.msl
@@ -0,0 +1,20 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ uint2 const x_1 = uint2(4u, 3u);
+ uint2 const x_10 = uint2(0u, x_1.y);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.spvasm
new file mode 100644
index 0000000..f63ae41
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_4 = OpConstant %uint 4
+ %uint_3 = OpConstant %uint 3
+ %9 = OpConstantComposite %v2uint %uint_4 %uint_3
+ %uint_0 = OpConstant %uint 0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpCompositeExtract %uint %9 1
+ %12 = OpCompositeConstruct %v2uint %uint_0 %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.wgsl
new file mode 100644
index 0000000..cb4f32f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.wgsl
@@ -0,0 +1,16 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ let x_1 : vec2<u32> = vec2<u32>(4u, 3u);
+ let x_10 : vec2<u32> = vec2<u32>(0u, x_1.y);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm
new file mode 100644
index 0000000..fd62310
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm
@@ -0,0 +1,46 @@
+; Test: SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%24 = OpConstantNull %mat3v2float
+%_struct_25 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%27 = OpConstantComposite %v2uint %uint_3 %uint_4
+%28 = OpConstantComposite %v2uint %uint_4 %uint_3
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%31 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %2
+%32 = OpLabel
+%10 = OpVectorShuffle %v4uint %27 %28 3 2 1 0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.hlsl
new file mode 100644
index 0000000..8ac6411
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const uint4 x_10 = uint4(uint2(4u, 3u).y, uint2(4u, 3u).x, uint2(3u, 4u).y, uint2(3u, 4u).x);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.msl
new file mode 100644
index 0000000..54f9b82
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ uint4 const x_10 = uint4(uint2(4u, 3u).y, uint2(4u, 3u).x, uint2(3u, 4u).y, uint2(3u, 4u).x);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.spvasm
new file mode 100644
index 0000000..d7b0084
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+ %v2uint = OpTypeVector %uint 2
+ %uint_4 = OpConstant %uint 4
+ %uint_3 = OpConstant %uint 3
+ %10 = OpConstantComposite %v2uint %uint_4 %uint_3
+ %13 = OpConstantComposite %v2uint %uint_3 %uint_4
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpCompositeExtract %uint %10 1
+ %12 = OpCompositeExtract %uint %10 0
+ %14 = OpCompositeExtract %uint %13 1
+ %15 = OpCompositeExtract %uint %13 0
+ %16 = OpCompositeConstruct %v4uint %11 %12 %14 %15
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.wgsl
new file mode 100644
index 0000000..76fc929
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ let x_10 : vec4<u32> = vec4<u32>(vec2<u32>(4u, 3u).y, vec2<u32>(4u, 3u).x, vec2<u32>(3u, 4u).y, vec2<u32>(3u, 4u).x);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm
new file mode 100644
index 0000000..b360b5d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%uint_3 = OpConstant %uint 3
+%uint_4 = OpConstant %uint 4
+%uint_5 = OpConstant %uint 5
+%int_1 = OpConstant %int 1
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%v2uint = OpTypeVector %uint 2
+%v3uint = OpTypeVector %uint 3
+%v4uint = OpTypeVector %uint 4
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%26 = OpConstantNull %mat3v2float
+%_struct_27 = OpTypeStruct %v2float %uint %int
+%_arr_uint_uint_5 = OpTypeArray %uint %uint_5
+%29 = OpConstantComposite %v2uint %uint_3 %uint_4
+%30 = OpConstantComposite %v2uint %uint_4 %uint_3
+%31 = OpConstantComposite %v2float %float_50 %float_60
+%32 = OpConstantComposite %v2float %float_60 %float_50
+%33 = OpConstantComposite %v2float %float_70 %float_70
+%100 = OpFunction %void None %4
+%34 = OpLabel
+%1 = OpCopyObject %v2uint %29
+%2 = OpIAdd %v2uint %30 %29
+%10 = OpVectorShuffle %v4uint %1 %2 3 2 1 0
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.hlsl
new file mode 100644
index 0000000..be343bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.hlsl
@@ -0,0 +1,12 @@
+void main_1() {
+ const uint2 x_1 = uint2(3u, 4u);
+ const uint2 x_2 = (uint2(4u, 3u) + uint2(3u, 4u));
+ const uint4 x_10 = uint4(x_2.y, x_2.x, x_1.y, x_1.x);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.msl b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.msl
new file mode 100644
index 0000000..7532ca9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct S {
+ float2 field0;
+ uint field1;
+ int field2;
+};
+
+void main_1() {
+ uint2 const x_1 = uint2(3u, 4u);
+ uint2 const x_2 = (uint2(4u, 3u) + uint2(3u, 4u));
+ uint4 const x_10 = uint4(x_2.y, x_2.x, x_1.y, x_1.x);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.spvasm
new file mode 100644
index 0000000..36eecad
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 21
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_3 = OpConstant %uint 3
+ %uint_4 = OpConstant %uint 4
+ %9 = OpConstantComposite %v2uint %uint_3 %uint_4
+ %10 = OpConstantComposite %v2uint %uint_4 %uint_3
+ %v4uint = OpTypeVector %uint 4
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %11 = OpIAdd %v2uint %10 %9
+ %13 = OpCompositeExtract %uint %11 1
+ %14 = OpCompositeExtract %uint %11 0
+ %15 = OpCompositeExtract %uint %9 1
+ %16 = OpCompositeExtract %uint %9 0
+ %17 = OpCompositeConstruct %v4uint %13 %14 %15 %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.wgsl
new file mode 100644
index 0000000..a82b9de
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.wgsl
@@ -0,0 +1,17 @@
+struct S {
+ field0 : vec2<f32>;
+ field1 : u32;
+ field2 : i32;
+};
+
+fn main_1() {
+ let x_1 : vec2<u32> = vec2<u32>(3u, 4u);
+ let x_2 : vec2<u32> = (vec2<u32>(4u, 3u) + vec2<u32>(3u, 4u));
+ let x_10 : vec4<u32> = vec4<u32>(x_2.y, x_2.x, x_1.y, x_1.x);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm
new file mode 100644
index 0000000..3d55d5e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvUnaryArithTest_FNegate_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFNegate %float %float_50
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..e369a1a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_1 = -(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..bbfcf2d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_1 = -(50.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..0d238ba
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,25 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpFNegate %float %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..054b45d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : f32 = -(50.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm
new file mode 100644
index 0000000..db365df
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvUnaryArithTest_FNegate_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpFNegate %v2float %25
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..0bb1446
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float2 x_1 = -(float2(50.0f, 60.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..245fc91
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = -(float2(50.0f, 60.0f));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..dd99469
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpFNegate %v2float %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..4f909860
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<f32> = -(vec2<f32>(50.0, 60.0));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm
new file mode 100644
index 0000000..07bbbf4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvUnaryArithTest_SNegate_Int_Int.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSNegate %int %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.hlsl
new file mode 100644
index 0000000..dda227d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = -(30);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.msl
new file mode 100644
index 0000000..8a0cc68
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = -(30);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.spvasm
new file mode 100644
index 0000000..a82b84c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.spvasm
@@ -0,0 +1,25 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpSNegate %int %int_30
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.wgsl
new file mode 100644
index 0000000..e45ce36
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = -(30);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm
new file mode 100644
index 0000000..9166c7e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvUnaryArithTest_SNegate_Int_Uint.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSNegate %int %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.hlsl
new file mode 100644
index 0000000..e1f744f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = -(asint(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.msl
new file mode 100644
index 0000000..9a0b0f7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = -(as_type<int>(10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.spvasm
new file mode 100644
index 0000000..d08b192
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %6 = OpBitcast %int %uint_10
+ %5 = OpSNegate %int %6
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.wgsl
new file mode 100644
index 0000000..a724b62
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = -(bitcast<i32>(10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm
new file mode 100644
index 0000000..d21de10
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSNegate %v2int %23
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.hlsl
new file mode 100644
index 0000000..05ee1e8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = -(int2(30, 40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.msl
new file mode 100644
index 0000000..37bd39b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = -(int2(30, 40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.spvasm
new file mode 100644
index 0000000..fd0c186
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %10 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpSNegate %v2int %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.wgsl
new file mode 100644
index 0000000..ca508f6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = -(vec2<i32>(30, 40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm
new file mode 100644
index 0000000..16e5304
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSNegate %v2int %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.hlsl
new file mode 100644
index 0000000..a5aa25f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = -(asint(uint2(10u, 20u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.msl
new file mode 100644
index 0000000..24c5e3c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = -(as_type<int2>(uint2(10u, 20u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.spvasm
new file mode 100644
index 0000000..4c5d463
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %13 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %6 = OpBitcast %v2int %13
+ %5 = OpSNegate %v2int %6
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.wgsl
new file mode 100644
index 0000000..12ce537
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = -(bitcast<vec2<i32>>(vec2<u32>(10u, 20u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm
new file mode 100644
index 0000000..8e67394
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvUnaryArithTest_SNegate_Uint_Int.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSNegate %uint %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.hlsl
new file mode 100644
index 0000000..3f8072a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint(-(30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.msl
new file mode 100644
index 0000000..7afd7f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>(-(30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.spvasm
new file mode 100644
index 0000000..f819fda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpSNegate %int %int_30
+ %5 = OpBitcast %uint %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.wgsl
new file mode 100644
index 0000000..1b940b1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>(-(30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm
new file mode 100644
index 0000000..273cfb6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvUnaryArithTest_SNegate_Uint_Uint.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSNegate %uint %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.hlsl
new file mode 100644
index 0000000..804956a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint(-(asint(10u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.msl
new file mode 100644
index 0000000..181216d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>(-(as_type<int>(10u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.spvasm
new file mode 100644
index 0000000..dcb1e68
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpBitcast %int %uint_10
+ %7 = OpSNegate %int %8
+ %5 = OpBitcast %uint %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.wgsl
new file mode 100644
index 0000000..2a97574
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>(-(bitcast<i32>(10u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm
new file mode 100644
index 0000000..42c4e4a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSNegate %v2uint %23
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.hlsl
new file mode 100644
index 0000000..c89b09b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint(-(int2(30, 40)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.msl
new file mode 100644
index 0000000..73a6e7e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>(-(int2(30, 40)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.spvasm
new file mode 100644
index 0000000..d030846
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %13 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpSNegate %v2int %13
+ %5 = OpBitcast %v2uint %8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.wgsl
new file mode 100644
index 0000000..480baac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>(-(vec2<i32>(30, 40)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm
new file mode 100644
index 0000000..2ce12b3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm
@@ -0,0 +1,50 @@
+; Test: SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%21 = OpConstantComposite %v2uint %uint_10 %uint_20
+%22 = OpConstantComposite %v2uint %uint_20 %uint_10
+%23 = OpConstantComposite %v2int %int_30 %int_40
+%24 = OpConstantComposite %v2int %int_40 %int_30
+%25 = OpConstantComposite %v2float %float_50 %float_60
+%26 = OpConstantComposite %v2float %float_60 %float_50
+%27 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%28 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%32 = OpConstantComposite %mat2v2float %25 %26
+%33 = OpConstantComposite %mat2v2float %26 %25
+%34 = OpConstantComposite %mat3v2float %25 %26 %25
+%35 = OpConstantComposite %mat2v3float %27 %28
+%100 = OpFunction %void None %3
+%36 = OpLabel
+%1 = OpSNegate %v2uint %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.hlsl
new file mode 100644
index 0000000..bb34342
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint(-(asint(uint2(10u, 20u))));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.msl
new file mode 100644
index 0000000..b557aef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>(-(as_type<int2>(uint2(10u, 20u))));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.spvasm
new file mode 100644
index 0000000..bed8b43
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.spvasm
@@ -0,0 +1,32 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 18
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %14 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpBitcast %v2int %14
+ %8 = OpSNegate %v2int %9
+ %5 = OpBitcast %v2uint %8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %16 = OpLabel
+ %17 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.wgsl
new file mode 100644
index 0000000..de725ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>(-(bitcast<vec2<i32>>(vec2<u32>(10u, 20u))));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm
new file mode 100644
index 0000000..8ab3975
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvUnaryArithTest_Transpose_2x2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %mat2v2float %33
+%2 = OpTranspose %mat2v2float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.hlsl
new file mode 100644
index 0000000..3ce255a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2x2 x_1 = float2x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f));
+ const float2x2 x_2 = transpose(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.msl
new file mode 100644
index 0000000..25b6177
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2x2 const x_1 = float2x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f));
+ float2x2 const x_2 = transpose(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.spvasm
new file mode 100644
index 0000000..df2b125
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat2v2float = OpTypeMatrix %v2float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %12 = OpConstantComposite %mat2v2float %10 %11
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpTranspose %mat2v2float %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.wgsl
new file mode 100644
index 0000000..751df07
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : mat2x2<f32> = mat2x2<f32>(vec2<f32>(50.0, 60.0), vec2<f32>(60.0, 50.0));
+ let x_2 : mat2x2<f32> = transpose(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm
new file mode 100644
index 0000000..41cfa82
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvUnaryArithTest_Transpose_2x3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %mat2v3float %36
+%2 = OpTranspose %mat3v2float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.hlsl
new file mode 100644
index 0000000..37a218a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2x3 x_1 = float2x3(float3(50.0f, 60.0f, 70.0f), float3(60.0f, 70.0f, 50.0f));
+ const float3x2 x_2 = transpose(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.msl
new file mode 100644
index 0000000..9f4e66f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2x3 const x_1 = float2x3(float3(50.0f, 60.0f, 70.0f), float3(60.0f, 70.0f, 50.0f));
+ float3x2 const x_2 = transpose(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.spvasm
new file mode 100644
index 0000000..9aa68e1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+%mat2v3float = OpTypeMatrix %v3float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %float_70 = OpConstant %float 70
+ %11 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+ %12 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+ %13 = OpConstantComposite %mat2v3float %11 %12
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %14 = OpTranspose %mat3v2float %13
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.wgsl
new file mode 100644
index 0000000..4de5b41
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : mat2x3<f32> = mat2x3<f32>(vec3<f32>(50.0, 60.0, 70.0), vec3<f32>(60.0, 70.0, 50.0));
+ let x_2 : mat3x2<f32> = transpose(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm
new file mode 100644
index 0000000..8ef234f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm
@@ -0,0 +1,51 @@
+; Test: SpvUnaryArithTest_Transpose_3x2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%4 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%float_70 = OpConstant %float 70
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%v3float = OpTypeVector %float 3
+%22 = OpConstantComposite %v2uint %uint_10 %uint_20
+%23 = OpConstantComposite %v2uint %uint_20 %uint_10
+%24 = OpConstantComposite %v2int %int_30 %int_40
+%25 = OpConstantComposite %v2int %int_40 %int_30
+%26 = OpConstantComposite %v2float %float_50 %float_60
+%27 = OpConstantComposite %v2float %float_60 %float_50
+%28 = OpConstantComposite %v3float %float_50 %float_60 %float_70
+%29 = OpConstantComposite %v3float %float_60 %float_70 %float_50
+%mat2v2float = OpTypeMatrix %v2float 2
+%mat2v3float = OpTypeMatrix %v3float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%33 = OpConstantComposite %mat2v2float %26 %27
+%34 = OpConstantComposite %mat2v2float %27 %26
+%35 = OpConstantComposite %mat3v2float %26 %27 %26
+%36 = OpConstantComposite %mat2v3float %28 %29
+%100 = OpFunction %void None %4
+%37 = OpLabel
+%1 = OpCopyObject %mat3v2float %35
+%2 = OpTranspose %mat2v3float %1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.hlsl
new file mode 100644
index 0000000..c95ec77
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float3x2 x_1 = float3x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f), float2(50.0f, 60.0f));
+ const float2x3 x_2 = transpose(x_1);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.msl
new file mode 100644
index 0000000..9262636
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float3x2 const x_1 = float3x2(float2(50.0f, 60.0f), float2(60.0f, 50.0f), float2(50.0f, 60.0f));
+ float2x3 const x_2 = transpose(x_1);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.spvasm
new file mode 100644
index 0000000..5629bf1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %10 = OpConstantComposite %v2float %float_50 %float_60
+ %11 = OpConstantComposite %v2float %float_60 %float_50
+ %12 = OpConstantComposite %mat3v2float %10 %11 %10
+ %v3float = OpTypeVector %float 3
+%mat2v3float = OpTypeMatrix %v3float 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpTranspose %mat2v3float %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.wgsl
new file mode 100644
index 0000000..69ed3f8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_1 : mat3x2<f32> = mat3x2<f32>(vec2<f32>(50.0, 60.0), vec2<f32>(60.0, 50.0), vec2<f32>(50.0, 60.0));
+ let x_2 : mat2x3<f32> = transpose(x_1);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm
new file mode 100644
index 0000000..828c239
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %i1 "i1"
+OpName %v2u1 "v2u1"
+OpName %v2i1 "v2i1"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %8
+%30 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%i1 = OpCopyObject %int %int_30
+%v2u1 = OpCopyObject %v2uint %24
+%v2i1 = OpCopyObject %v2int %26
+%1 = OpBitCount %v2int %v2i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.hlsl
new file mode 100644
index 0000000..a74cb65
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+void main_1() {
+ const uint u1 = 10u;
+ const int i1 = 30;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 x_1 = countbits(v2i1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.msl
new file mode 100644
index 0000000..5e5318b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ int const i1 = 30;
+ uint2 const v2u1 = uint2(10u, 20u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const x_1 = popcount(v2i1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.spvasm
new file mode 100644
index 0000000..6b32833
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %11 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %15 = OpBitCount %v2int %14
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.wgsl
new file mode 100644
index 0000000..1602531
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let i1 : i32 = 30;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : vec2<i32> = countOneBits(v2i1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm
new file mode 100644
index 0000000..d890816
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %i1 "i1"
+OpName %v2u1 "v2u1"
+OpName %v2i1 "v2i1"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %8
+%30 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%i1 = OpCopyObject %int %int_30
+%v2u1 = OpCopyObject %v2uint %24
+%v2i1 = OpCopyObject %v2int %26
+%1 = OpBitCount %v2int %v2u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.hlsl
new file mode 100644
index 0000000..7e6c5c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+void main_1() {
+ const uint u1 = 10u;
+ const int i1 = 30;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 x_1 = asint(countbits(v2u1));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.msl
new file mode 100644
index 0000000..8534554
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ int const i1 = 30;
+ uint2 const v2u1 = uint2(10u, 20u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const x_1 = as_type<int2>(popcount(v2u1));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.spvasm
new file mode 100644
index 0000000..19f814f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %11 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %16 = OpBitCount %v2uint %11
+ %15 = OpBitcast %v2int %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.wgsl
new file mode 100644
index 0000000..b026757
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let i1 : i32 = 30;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : vec2<i32> = bitcast<vec2<i32>>(countOneBits(v2u1));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm
new file mode 100644
index 0000000..6654c0c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvUnaryBitTest_BitCount_Int_Int.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %i1 "i1"
+OpName %v2u1 "v2u1"
+OpName %v2i1 "v2i1"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %8
+%30 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%i1 = OpCopyObject %int %int_30
+%v2u1 = OpCopyObject %v2uint %24
+%v2i1 = OpCopyObject %v2int %26
+%1 = OpBitCount %int %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.hlsl
new file mode 100644
index 0000000..7b091c8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+void main_1() {
+ const uint u1 = 10u;
+ const int i1 = 30;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const int2 v2i1 = int2(30, 40);
+ const int x_1 = countbits(i1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.msl
new file mode 100644
index 0000000..2926cf7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ int const i1 = 30;
+ uint2 const v2u1 = uint2(10u, 20u);
+ int2 const v2i1 = int2(30, 40);
+ int const x_1 = popcount(i1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.spvasm
new file mode 100644
index 0000000..39559dd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %11 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %15 = OpBitCount %int %int_30
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.wgsl
new file mode 100644
index 0000000..a5be6f6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let i1 : i32 = 30;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : i32 = countOneBits(i1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm
new file mode 100644
index 0000000..4a09ef0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvUnaryBitTest_BitCount_Int_Uint.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %i1 "i1"
+OpName %v2u1 "v2u1"
+OpName %v2i1 "v2i1"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %8
+%30 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%i1 = OpCopyObject %int %int_30
+%v2u1 = OpCopyObject %v2uint %24
+%v2i1 = OpCopyObject %v2int %26
+%1 = OpBitCount %int %u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.hlsl
new file mode 100644
index 0000000..c63362f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+void main_1() {
+ const uint u1 = 10u;
+ const int i1 = 30;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const int2 v2i1 = int2(30, 40);
+ const int x_1 = asint(countbits(u1));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.msl
new file mode 100644
index 0000000..da169f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ int const i1 = 30;
+ uint2 const v2u1 = uint2(10u, 20u);
+ int2 const v2i1 = int2(30, 40);
+ int const x_1 = as_type<int>(popcount(u1));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.spvasm
new file mode 100644
index 0000000..8b67a15
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %11 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %16 = OpBitCount %uint %uint_10
+ %15 = OpBitcast %int %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.wgsl
new file mode 100644
index 0000000..56eb02d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let i1 : i32 = 30;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : i32 = bitcast<i32>(countOneBits(u1));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm
new file mode 100644
index 0000000..2cc0c93
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %i1 "i1"
+OpName %v2u1 "v2u1"
+OpName %v2i1 "v2i1"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %8
+%30 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%i1 = OpCopyObject %int %int_30
+%v2u1 = OpCopyObject %v2uint %24
+%v2i1 = OpCopyObject %v2int %26
+%1 = OpBitCount %v2uint %v2i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.hlsl
new file mode 100644
index 0000000..39bb2b5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+void main_1() {
+ const uint u1 = 10u;
+ const int i1 = 30;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const int2 v2i1 = int2(30, 40);
+ const uint2 x_1 = asuint(countbits(v2i1));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.msl
new file mode 100644
index 0000000..c7677e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ int const i1 = 30;
+ uint2 const v2u1 = uint2(10u, 20u);
+ int2 const v2i1 = int2(30, 40);
+ uint2 const x_1 = as_type<uint2>(popcount(v2i1));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.spvasm
new file mode 100644
index 0000000..623cfd2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %11 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %16 = OpBitCount %v2int %14
+ %15 = OpBitcast %v2uint %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.wgsl
new file mode 100644
index 0000000..ae46259
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let i1 : i32 = 30;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>(countOneBits(v2i1));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm
new file mode 100644
index 0000000..c4ee216
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %i1 "i1"
+OpName %v2u1 "v2u1"
+OpName %v2i1 "v2i1"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %8
+%30 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%i1 = OpCopyObject %int %int_30
+%v2u1 = OpCopyObject %v2uint %24
+%v2i1 = OpCopyObject %v2int %26
+%1 = OpBitCount %v2uint %v2u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.hlsl
new file mode 100644
index 0000000..061d888
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+void main_1() {
+ const uint u1 = 10u;
+ const int i1 = 30;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const int2 v2i1 = int2(30, 40);
+ const uint2 x_1 = countbits(v2u1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.msl
new file mode 100644
index 0000000..5c913c0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ int const i1 = 30;
+ uint2 const v2u1 = uint2(10u, 20u);
+ int2 const v2i1 = int2(30, 40);
+ uint2 const x_1 = popcount(v2u1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.spvasm
new file mode 100644
index 0000000..217cc0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %11 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %15 = OpBitCount %v2uint %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.wgsl
new file mode 100644
index 0000000..70ee7e7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let i1 : i32 = 30;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : vec2<u32> = countOneBits(v2u1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm
new file mode 100644
index 0000000..34c8702
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvUnaryBitTest_BitCount_Uint_Int.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %i1 "i1"
+OpName %v2u1 "v2u1"
+OpName %v2i1 "v2i1"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %8
+%30 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%i1 = OpCopyObject %int %int_30
+%v2u1 = OpCopyObject %v2uint %24
+%v2i1 = OpCopyObject %v2int %26
+%1 = OpBitCount %uint %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.hlsl
new file mode 100644
index 0000000..f630817
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+void main_1() {
+ const uint u1 = 10u;
+ const int i1 = 30;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const int2 v2i1 = int2(30, 40);
+ const uint x_1 = asuint(countbits(i1));
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.msl
new file mode 100644
index 0000000..898195b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ int const i1 = 30;
+ uint2 const v2u1 = uint2(10u, 20u);
+ int2 const v2i1 = int2(30, 40);
+ uint const x_1 = as_type<uint>(popcount(i1));
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.spvasm
new file mode 100644
index 0000000..b508644
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 20
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %11 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %16 = OpBitCount %int %int_30
+ %15 = OpBitcast %uint %16
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.wgsl
new file mode 100644
index 0000000..df7f6e5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let i1 : i32 = 30;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : u32 = bitcast<u32>(countOneBits(i1));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm
new file mode 100644
index 0000000..8b9d40a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvUnaryBitTest_BitCount_Uint_Uint.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %i1 "i1"
+OpName %v2u1 "v2u1"
+OpName %v2i1 "v2i1"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %8
+%30 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%i1 = OpCopyObject %int %int_30
+%v2u1 = OpCopyObject %v2uint %24
+%v2i1 = OpCopyObject %v2int %26
+%1 = OpBitCount %uint %u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.hlsl
new file mode 100644
index 0000000..e61ae04
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+void main_1() {
+ const uint u1 = 10u;
+ const int i1 = 30;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const int2 v2i1 = int2(30, 40);
+ const uint x_1 = countbits(u1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.msl
new file mode 100644
index 0000000..586570a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ int const i1 = 30;
+ uint2 const v2u1 = uint2(10u, 20u);
+ int2 const v2i1 = int2(30, 40);
+ uint const x_1 = popcount(u1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.spvasm
new file mode 100644
index 0000000..54532f3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %11 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %15 = OpBitCount %uint %uint_10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.wgsl
new file mode 100644
index 0000000..3a50022
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let i1 : i32 = 30;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : u32 = countOneBits(u1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm
new file mode 100644
index 0000000..a801877
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %i1 "i1"
+OpName %v2u1 "v2u1"
+OpName %v2i1 "v2i1"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %8
+%30 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%i1 = OpCopyObject %int %int_30
+%v2u1 = OpCopyObject %v2uint %24
+%v2i1 = OpCopyObject %v2int %26
+%1 = OpBitReverse %v2int %v2i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.hlsl
new file mode 100644
index 0000000..0b913fd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+void main_1() {
+ const uint u1 = 10u;
+ const int i1 = 30;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const int2 v2i1 = int2(30, 40);
+ const int2 x_1 = reversebits(v2i1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.msl
new file mode 100644
index 0000000..84640e6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ int const i1 = 30;
+ uint2 const v2u1 = uint2(10u, 20u);
+ int2 const v2i1 = int2(30, 40);
+ int2 const x_1 = reverse_bits(v2i1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.spvasm
new file mode 100644
index 0000000..e6dd3b9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %11 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %15 = OpBitReverse %v2int %14
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.wgsl
new file mode 100644
index 0000000..97da394
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let i1 : i32 = 30;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : vec2<i32> = reverseBits(v2i1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm
new file mode 100644
index 0000000..7567958
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvUnaryBitTest_BitReverse_Int_Int.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %i1 "i1"
+OpName %v2u1 "v2u1"
+OpName %v2i1 "v2i1"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %8
+%30 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%i1 = OpCopyObject %int %int_30
+%v2u1 = OpCopyObject %v2uint %24
+%v2i1 = OpCopyObject %v2int %26
+%1 = OpBitReverse %int %i1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.hlsl
new file mode 100644
index 0000000..a73c3bb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+void main_1() {
+ const uint u1 = 10u;
+ const int i1 = 30;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const int2 v2i1 = int2(30, 40);
+ const int x_1 = reversebits(i1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.msl
new file mode 100644
index 0000000..362484c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ int const i1 = 30;
+ uint2 const v2u1 = uint2(10u, 20u);
+ int2 const v2i1 = int2(30, 40);
+ int const x_1 = reverse_bits(i1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.spvasm
new file mode 100644
index 0000000..b164bbe
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %11 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %15 = OpBitReverse %int %int_30
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.wgsl
new file mode 100644
index 0000000..b4f28a1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let i1 : i32 = 30;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : i32 = reverseBits(i1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm
new file mode 100644
index 0000000..cdfc2ad
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %i1 "i1"
+OpName %v2u1 "v2u1"
+OpName %v2i1 "v2i1"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %8
+%30 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%i1 = OpCopyObject %int %int_30
+%v2u1 = OpCopyObject %v2uint %24
+%v2i1 = OpCopyObject %v2int %26
+%1 = OpBitReverse %v2uint %v2u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.hlsl
new file mode 100644
index 0000000..a00c844
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+void main_1() {
+ const uint u1 = 10u;
+ const int i1 = 30;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const int2 v2i1 = int2(30, 40);
+ const uint2 x_1 = reversebits(v2u1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.msl
new file mode 100644
index 0000000..c43e1a2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ int const i1 = 30;
+ uint2 const v2u1 = uint2(10u, 20u);
+ int2 const v2i1 = int2(30, 40);
+ uint2 const x_1 = reverse_bits(v2u1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.spvasm
new file mode 100644
index 0000000..6f35e4f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %11 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %15 = OpBitReverse %v2uint %11
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.wgsl
new file mode 100644
index 0000000..d8fc5b2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let i1 : i32 = 30;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : vec2<u32> = reverseBits(v2u1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm
new file mode 100644
index 0000000..8e061a2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm
@@ -0,0 +1,48 @@
+; Test: SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+%2 = OpExtInstImport "GLSL.std.450"
+OpMemoryModel Logical GLSL450
+OpEntryPoint GLCompute %100 "main"
+OpExecutionMode %100 LocalSize 1 1 1
+OpName %u1 "u1"
+OpName %i1 "i1"
+OpName %v2u1 "v2u1"
+OpName %v2i1 "v2i1"
+%void = OpTypeVoid
+%8 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %8
+%30 = OpLabel
+%u1 = OpCopyObject %uint %uint_10
+%i1 = OpCopyObject %int %int_30
+%v2u1 = OpCopyObject %v2uint %24
+%v2i1 = OpCopyObject %v2int %26
+%1 = OpBitReverse %uint %u1
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.hlsl
new file mode 100644
index 0000000..3fbf216
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.hlsl
@@ -0,0 +1,14 @@
+void main_1() {
+ const uint u1 = 10u;
+ const int i1 = 30;
+ const uint2 v2u1 = uint2(10u, 20u);
+ const int2 v2i1 = int2(30, 40);
+ const uint x_1 = reversebits(u1);
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.msl
new file mode 100644
index 0000000..46ed69f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.msl
@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const u1 = 10u;
+ int const i1 = 30;
+ uint2 const v2u1 = uint2(10u, 20u);
+ int2 const v2i1 = int2(30, 40);
+ uint const x_1 = reverse_bits(u1);
+ return;
+}
+
+kernel void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.spvasm
new file mode 100644
index 0000000..198d84a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %main "main"
+ OpExecutionMode %main LocalSize 1 1 1
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %v2uint = OpTypeVector %uint 2
+ %uint_20 = OpConstant %uint 20
+ %11 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %v2int = OpTypeVector %int 2
+ %int_40 = OpConstant %int 40
+ %14 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %15 = OpBitReverse %uint %uint_10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.wgsl
new file mode 100644
index 0000000..e6bc8af
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.wgsl
@@ -0,0 +1,13 @@
+fn main_1() {
+ let u1 : u32 = 10u;
+ let i1 : i32 = 30;
+ let v2u1 : vec2<u32> = vec2<u32>(10u, 20u);
+ let v2i1 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : u32 = reverseBits(u1);
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm
new file mode 100644
index 0000000..1c58585
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvUnaryBitTest_Not_Int_Int.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpNot %int %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.hlsl
new file mode 100644
index 0000000..d2088a6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = ~(30);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.msl
new file mode 100644
index 0000000..2a5889c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = ~(30);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.spvasm
new file mode 100644
index 0000000..de9da51
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.spvasm
@@ -0,0 +1,25 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpNot %int %int_30
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.wgsl
new file mode 100644
index 0000000..ba77c8b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = ~(30);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm
new file mode 100644
index 0000000..7285237
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvUnaryBitTest_Not_Int_Uint.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpNot %int %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.hlsl
new file mode 100644
index 0000000..419c8eb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = asint(~(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.msl
new file mode 100644
index 0000000..25d88c1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_1 = as_type<int>(~(10u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.spvasm
new file mode 100644
index 0000000..a9f4544
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpNot %uint %uint_10
+ %5 = OpBitcast %int %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.wgsl
new file mode 100644
index 0000000..4a0d1d2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : i32 = bitcast<i32>(~(10u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm
new file mode 100644
index 0000000..9954fda
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpNot %v2int %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.hlsl
new file mode 100644
index 0000000..c31086e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = ~(int2(30, 40));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.msl
new file mode 100644
index 0000000..49ddd7c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = ~(int2(30, 40));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.spvasm
new file mode 100644
index 0000000..216d11c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %10 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpNot %v2int %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.wgsl
new file mode 100644
index 0000000..f995c02
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = ~(vec2<i32>(30, 40));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm
new file mode 100644
index 0000000..411a131
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpNot %v2int %19
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.hlsl
new file mode 100644
index 0000000..4afab65
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int2 x_1 = asint(~(uint2(10u, 20u)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.msl
new file mode 100644
index 0000000..c856d53
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_1 = as_type<int2>(~(uint2(10u, 20u)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.spvasm
new file mode 100644
index 0000000..2cdcffd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %13 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpNot %v2uint %13
+ %5 = OpBitcast %v2int %8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.wgsl
new file mode 100644
index 0000000..0e9634a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<i32> = bitcast<vec2<i32>>(~(vec2<u32>(10u, 20u)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm
new file mode 100644
index 0000000..df06328
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvUnaryBitTest_Not_Uint_Int.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpNot %uint %int_30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.hlsl
new file mode 100644
index 0000000..412cd83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint(~(30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.msl
new file mode 100644
index 0000000..31af6b7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>(~(30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.spvasm
new file mode 100644
index 0000000..de53b0f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.spvasm
@@ -0,0 +1,27 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpNot %int %int_30
+ %5 = OpBitcast %uint %7
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %11 = OpLabel
+ %12 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.wgsl
new file mode 100644
index 0000000..33488fc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>(~(30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm
new file mode 100644
index 0000000..7471b60
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvUnaryBitTest_Not_Uint_Uint.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpNot %uint %uint_10
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.hlsl
new file mode 100644
index 0000000..c6bcbd3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = ~(10u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.msl
new file mode 100644
index 0000000..8a0b29f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = ~(10u);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.spvasm
new file mode 100644
index 0000000..52708c0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.spvasm
@@ -0,0 +1,25 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpNot %uint %uint_10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.wgsl
new file mode 100644
index 0000000..b5b5737
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = ~(10u);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm
new file mode 100644
index 0000000..80d91a7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpNot %v2uint %21
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.hlsl
new file mode 100644
index 0000000..23e8405
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = asuint(~(int2(30, 40)));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.msl
new file mode 100644
index 0000000..a36ed94
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = as_type<uint2>(~(int2(30, 40)));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.spvasm
new file mode 100644
index 0000000..5a5760f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.spvasm
@@ -0,0 +1,31 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 17
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %13 = OpConstantComposite %v2int %int_30 %int_40
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %8 = OpNot %v2int %13
+ %5 = OpBitcast %v2uint %8
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %15 = OpLabel
+ %16 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.wgsl
new file mode 100644
index 0000000..599e40c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>(~(vec2<i32>(30, 40)));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm
new file mode 100644
index 0000000..65a4a81
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm
@@ -0,0 +1,39 @@
+; Test: SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%19 = OpConstantComposite %v2uint %uint_10 %uint_20
+%20 = OpConstantComposite %v2uint %uint_20 %uint_10
+%21 = OpConstantComposite %v2int %int_30 %int_40
+%22 = OpConstantComposite %v2int %int_40 %int_30
+%23 = OpConstantComposite %v2float %float_50 %float_60
+%24 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%25 = OpLabel
+%1 = OpNot %v2uint %19
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.hlsl
new file mode 100644
index 0000000..6dce691
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint2 x_1 = ~(uint2(10u, 20u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.msl
new file mode 100644
index 0000000..466557e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_1 = ~(uint2(10u, 20u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.spvasm
new file mode 100644
index 0000000..56fd96e
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %10 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpNot %v2uint %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.wgsl
new file mode 100644
index 0000000..365232c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<u32> = ~(vec2<u32>(10u, 20u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm
new file mode 100644
index 0000000..d3be0e6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm
@@ -0,0 +1,44 @@
+; Test: SpvUnaryConversionTest_Bitcast_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%30 = OpLabel
+%1 = OpBitcast %uint %float_50
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..50712af
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..f49756a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_1 = as_type<uint>(50.0f);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..3f9dc7d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %uint %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..bc3e4f0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : u32 = bitcast<u32>(50.0);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm
new file mode 100644
index 0000000..4277cf9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm
@@ -0,0 +1,44 @@
+; Test: SpvUnaryConversionTest_Bitcast_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%30 = OpLabel
+%1 = OpBitcast %v2float %24
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..5fa0315
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float2 x_1 = asfloat(uint2(10u, 20u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..e9a42bd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_1 = as_type<float2>(uint2(10u, 20u));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..4e1b6a3
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %12 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpBitcast %v2float %12
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..b246e5c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<f32> = bitcast<vec2<f32>>(vec2<u32>(10u, 20u));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm
new file mode 100644
index 0000000..38fb69d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %float %float_50
+%1 = OpConvertFToS %int %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..37bf3ea
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const int x_1 = int(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.msl
new file mode 100644
index 0000000..63ba130
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_30 = 50.0f;
+ int const x_1 = int(x_30);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..dafa8c6
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %int = OpTypeInt 32 1
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpConvertFToS %int %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..67c9af7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : f32 = 50.0;
+ let x_1 : i32 = i32(x_30);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm
new file mode 100644
index 0000000..7122c9b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %float %float_50
+%1 = OpConvertFToS %uint %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..cf36d40
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = asuint(int(50.0f));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.msl
new file mode 100644
index 0000000..dde5810
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_30 = 50.0f;
+ uint const x_1 = as_type<uint>(int(x_30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..4e71a6a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %uint = OpTypeInt 32 0
+ %int = OpTypeInt 32 1
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpConvertFToS %int %float_50
+ %7 = OpBitcast %uint %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..a1e3904
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : f32 = 50.0;
+ let x_1 : u32 = bitcast<u32>(i32(x_30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm
new file mode 100644
index 0000000..bcac2ac
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %v2float %28
+%1 = OpConvertFToS %v2int %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..d3c3333
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_30 = float2(50.0f, 60.0f);
+ const int2 x_1 = int2(x_30);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.msl
new file mode 100644
index 0000000..e576c46
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_30 = float2(50.0f, 60.0f);
+ int2 const x_1 = int2(x_30);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..985a540
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpConvertFToS %v2int %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..8e28abb
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_1 : vec2<i32> = vec2<i32>(x_30);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm
new file mode 100644
index 0000000..e4ceaa5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %v2float %28
+%1 = OpConvertFToS %v2uint %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..5ebd2d5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_30 = float2(50.0f, 60.0f);
+ const uint2 x_1 = asuint(int2(x_30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.msl
new file mode 100644
index 0000000..9205302
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_30 = float2(50.0f, 60.0f);
+ uint2 const x_1 = as_type<uint2>(int2(x_30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..1b4a5a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpConvertFToS %v2int %9
+ %10 = OpBitcast %v2uint %13
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..87519d5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_1 : vec2<u32> = bitcast<vec2<u32>>(vec2<i32>(x_30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm
new file mode 100644
index 0000000..48e2b14
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm
@@ -0,0 +1,59 @@
+; Test: SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 601
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %2
+%10 = OpLabel
+OpBranch %30
+%30 = OpLabel
+OpLoopMerge %90 %80 None
+OpBranchConditional %true %90 %40
+%40 = OpLabel
+OpSelectionMerge %50 None
+OpBranchConditional %true %45 %50
+%45 = OpLabel
+%600 = OpCopyObject %float %float_50
+OpBranch %50
+%50 = OpLabel
+OpBranch %90
+%80 = OpLabel
+%82 = OpConvertFToU %uint %600
+OpBranch %30
+%90 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.hlsl
new file mode 100644
index 0000000..0b7e61f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.hlsl
@@ -0,0 +1,21 @@
+void main_1() {
+ while (true) {
+ float x_600 = 0.0f;
+ if (true) {
+ break;
+ }
+ if (true) {
+ x_600 = 50.0f;
+ }
+ break;
+ {
+ const uint x_82 = uint(x_600);
+ }
+ }
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.msl
new file mode 100644
index 0000000..35623e0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.msl
@@ -0,0 +1,25 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ while (true) {
+ float x_600 = 0.0f;
+ if (true) {
+ break;
+ }
+ if (true) {
+ x_600 = 50.0f;
+ }
+ break;
+ {
+ uint const x_82 = uint(x_600);
+ }
+ }
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.spvasm
new file mode 100644
index 0000000..6d41788
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %x_600 "x_600"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+%_ptr_Function_float = OpTypePointer Function %float
+ %12 = OpConstantNull %float
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %float_50 = OpConstant %float 50
+ %uint = OpTypeInt 32 0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %x_600 = OpVariable %_ptr_Function_float Function %12
+ OpBranch %5
+ %5 = OpLabel
+ OpLoopMerge %6 %7 None
+ OpBranch %8
+ %8 = OpLabel
+ OpSelectionMerge %15 None
+ OpBranchConditional %true %16 %15
+ %16 = OpLabel
+ OpBranch %6
+ %15 = OpLabel
+ OpSelectionMerge %17 None
+ OpBranchConditional %true %18 %17
+ %18 = OpLabel
+ OpStore %x_600 %float_50
+ OpBranch %17
+ %17 = OpLabel
+ OpBranch %6
+ %7 = OpLabel
+ %22 = OpLoad %float %x_600
+ %20 = OpConvertFToU %uint %22
+ OpBranch %5
+ %6 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.wgsl
new file mode 100644
index 0000000..6678285
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.wgsl
@@ -0,0 +1,22 @@
+fn main_1() {
+ loop {
+ var x_600 : f32;
+ if (true) {
+ break;
+ }
+ if (true) {
+ x_600 = 50.0;
+ }
+ break;
+
+ continuing {
+ let x_82 : u32 = u32(x_600);
+ }
+ }
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm
new file mode 100644
index 0000000..16e12c5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %float %float_50
+%1 = OpConvertFToU %uint %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..f9bd3d1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const uint x_1 = uint(50.0f);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.msl
new file mode 100644
index 0000000..5816307
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float const x_30 = 50.0f;
+ uint const x_1 = uint(x_30);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..d92f19d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_50 = OpConstant %float 50
+ %uint = OpTypeInt 32 0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpConvertFToU %uint %float_50
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..d5fc2a0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : f32 = 50.0;
+ let x_1 : u32 = u32(x_30);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm
new file mode 100644
index 0000000..96ba6fc
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %v2float %28
+%1 = OpConvertFToU %v2uint %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..e3598e1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const float2 x_30 = float2(50.0f, 60.0f);
+ const uint2 x_1 = uint2(x_30);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.msl
new file mode 100644
index 0000000..f625fd7
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ float2 const x_30 = float2(50.0f, 60.0f);
+ uint2 const x_1 = uint2(x_30);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..3382ffd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %float_50 = OpConstant %float 50
+ %float_60 = OpConstant %float 60
+ %9 = OpConstantComposite %v2float %float_50 %float_60
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpConvertFToU %v2uint %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..0a56609
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : vec2<f32> = vec2<f32>(50.0, 60.0);
+ let x_1 : vec2<u32> = vec2<u32>(x_30);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm
new file mode 100644
index 0000000..5a2eec8
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %int %int_30
+%1 = OpConvertSToF %float %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..15cffe5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_1 = float(30);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.msl
new file mode 100644
index 0000000..7d826c9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_30 = 30;
+ float const x_1 = float(x_30);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..01149f4
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %float = OpTypeFloat 32
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpConvertSToF %float %int_30
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..f2a25de
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : i32 = 30;
+ let x_1 : f32 = f32(x_30);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm
new file mode 100644
index 0000000..64806a5
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %uint %uint_10
+%1 = OpConvertSToF %float %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..69adf2f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_1 = float(asint(10u));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.msl
new file mode 100644
index 0000000..81eb6593
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_30 = 10u;
+ float const x_1 = float(as_type<int>(x_30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..4c858de
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %float = OpTypeFloat 32
+ %int = OpTypeInt 32 1
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpBitcast %int %uint_10
+ %7 = OpConvertSToF %float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..4dfbe0a
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : u32 = 10u;
+ let x_1 : f32 = f32(bitcast<i32>(x_30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm
new file mode 100644
index 0000000..eced5c0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %v2int %26
+%1 = OpConvertSToF %v2float %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..ec27605
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const int2 x_30 = int2(30, 40);
+ const float2 x_1 = float2(x_30);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.msl
new file mode 100644
index 0000000..3d1641c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_30 = int2(30, 40);
+ float2 const x_1 = float2(x_30);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..1ae6382
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpConvertSToF %v2float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..890b5ef
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : vec2<f32> = vec2<f32>(x_30);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm
new file mode 100644
index 0000000..098e289
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %v2uint %24
+%1 = OpConvertSToF %v2float %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..3c03393
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const uint2 x_30 = uint2(10u, 20u);
+ const float2 x_1 = float2(asint(x_30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.msl
new file mode 100644
index 0000000..a465e1b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_30 = uint2(10u, 20u);
+ float2 const x_1 = float2(as_type<int2>(x_30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..84c993d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2int %9
+ %10 = OpConvertSToF %v2float %13
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..4b89c49
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : vec2<u32> = vec2<u32>(10u, 20u);
+ let x_1 : vec2<f32> = vec2<f32>(bitcast<vec2<i32>>(x_30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm
new file mode 100644
index 0000000..661a4f1
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %int %int_30
+%1 = OpConvertUToF %float %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..ceb6068
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_1 = float(asuint(30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.msl
new file mode 100644
index 0000000..bbba127
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int const x_30 = 30;
+ float const x_1 = float(as_type<uint>(x_30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..6dff3cf
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_30 = OpConstant %int 30
+ %float = OpTypeFloat 32
+ %uint = OpTypeInt 32 0
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %9 = OpBitcast %uint %int_30
+ %7 = OpConvertUToF %float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..c441a83
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : i32 = 30;
+ let x_1 : f32 = f32(bitcast<u32>(x_30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm
new file mode 100644
index 0000000..cb14cb9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %uint %uint_10
+%1 = OpConvertUToF %float %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..9cf6f11
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const float x_1 = float(10u);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.msl
new file mode 100644
index 0000000..67605f2
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint const x_30 = 10u;
+ float const x_1 = float(x_30);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..fa7fada
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_10 = OpConstant %uint 10
+ %float = OpTypeFloat 32
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %7 = OpConvertUToF %float %uint_10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..97057ca
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : u32 = 10u;
+ let x_1 : f32 = f32(x_30);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm
new file mode 100644
index 0000000..ccdafc9
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %v2int %26
+%1 = OpConvertUToF %v2float %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..78b7747
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const int2 x_30 = int2(30, 40);
+ const float2 x_1 = float2(asuint(x_30));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.msl
new file mode 100644
index 0000000..332c882
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ int2 const x_30 = int2(30, 40);
+ float2 const x_1 = float2(as_type<uint2>(x_30));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..0459c16
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.spvasm
@@ -0,0 +1,33 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 19
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_30 = OpConstant %int 30
+ %int_40 = OpConstant %int 40
+ %9 = OpConstantComposite %v2int %int_30 %int_40
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %13 = OpBitcast %v2uint %9
+ %10 = OpConvertUToF %v2float %13
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..f0901ef0
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : vec2<i32> = vec2<i32>(30, 40);
+ let x_1 : vec2<f32> = vec2<f32>(bitcast<vec2<u32>>(x_30));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm
new file mode 100644
index 0000000..c8b860f
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%v2bool = OpTypeVector %bool 2
+%11 = OpConstantComposite %v2bool %true %false
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%24 = OpConstantComposite %v2uint %uint_10 %uint_20
+%25 = OpConstantComposite %v2uint %uint_20 %uint_10
+%26 = OpConstantComposite %v2int %int_30 %int_40
+%27 = OpConstantComposite %v2int %int_40 %int_30
+%28 = OpConstantComposite %v2float %float_50 %float_60
+%29 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%30 = OpCopyObject %v2uint %24
+%1 = OpConvertUToF %v2float %30
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.hlsl
new file mode 100644
index 0000000..1850a19
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.hlsl
@@ -0,0 +1,10 @@
+void main_1() {
+ const uint2 x_30 = uint2(10u, 20u);
+ const float2 x_1 = float2(x_30);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.msl
new file mode 100644
index 0000000..dc3b443
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ uint2 const x_30 = uint2(10u, 20u);
+ float2 const x_1 = float2(x_30);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.spvasm
new file mode 100644
index 0000000..597f34c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.spvasm
@@ -0,0 +1,30 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %uint_10 = OpConstant %uint 10
+ %uint_20 = OpConstant %uint 20
+ %9 = OpConstantComposite %v2uint %uint_10 %uint_20
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %10 = OpConvertUToF %v2float %9
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.wgsl
new file mode 100644
index 0000000..7a949fd
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.wgsl
@@ -0,0 +1,10 @@
+fn main_1() {
+ let x_30 : vec2<u32> = vec2<u32>(10u, 20u);
+ let x_1 : vec2<f32> = vec2<f32>(x_30);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm
new file mode 100644
index 0000000..1e3842c
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpLogicalNot %bool %true
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.hlsl
new file mode 100644
index 0000000..971e568
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool x_1 = !(true);
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.msl
new file mode 100644
index 0000000..b29b9ed
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool const x_1 = !(true);
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.spvasm
new file mode 100644
index 0000000..c5b1780
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.spvasm
@@ -0,0 +1,25 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 11
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %true = OpConstantTrue %bool
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpLogicalNot %bool %true
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %9 = OpLabel
+ %10 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.wgsl
new file mode 100644
index 0000000..8619a46
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : bool = !(true);
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm
new file mode 100644
index 0000000..3dc45aa
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm
@@ -0,0 +1,45 @@
+; Test: SpvUnaryLogicalTest_LogicalNot_Vector.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%3 = OpTypeFunction %void
+%bool = OpTypeBool
+%true = OpConstantTrue %bool
+%false = OpConstantFalse %bool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%uint_10 = OpConstant %uint 10
+%uint_20 = OpConstant %uint 20
+%int_30 = OpConstant %int 30
+%int_40 = OpConstant %int 40
+%float_50 = OpConstant %float 50
+%float_60 = OpConstant %float 60
+%_ptr_Function_uint = OpTypePointer Function %uint
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%23 = OpConstantComposite %v2bool %true %false
+%24 = OpConstantComposite %v2bool %false %true
+%25 = OpConstantComposite %v2uint %uint_10 %uint_20
+%26 = OpConstantComposite %v2uint %uint_20 %uint_10
+%27 = OpConstantComposite %v2int %int_30 %int_40
+%28 = OpConstantComposite %v2int %int_40 %int_30
+%29 = OpConstantComposite %v2float %float_50 %float_60
+%30 = OpConstantComposite %v2float %float_60 %float_50
+%100 = OpFunction %void None %3
+%31 = OpLabel
+%1 = OpLogicalNot %v2bool %23
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.hlsl
new file mode 100644
index 0000000..96a249d
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.hlsl
@@ -0,0 +1,9 @@
+void main_1() {
+ const bool2 x_1 = !(bool2(true, false));
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.msl b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.msl
new file mode 100644
index 0000000..69e0b18
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ bool2 const x_1 = !(bool2(true, false));
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.spvasm b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.spvasm
new file mode 100644
index 0000000..cc48336
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.spvasm
@@ -0,0 +1,28 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 14
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %true = OpConstantTrue %bool
+ %false = OpConstantFalse %bool
+ %10 = OpConstantComposite %v2bool %true %false
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ %5 = OpLogicalNot %v2bool %10
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %12 = OpLabel
+ %13 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.wgsl b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.wgsl
new file mode 100644
index 0000000..71c370b
--- /dev/null
+++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.wgsl
@@ -0,0 +1,9 @@
+fn main_1() {
+ let x_1 : vec2<bool> = !(vec2<bool>(true, false));
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm
new file mode 100644
index 0000000..2035e68
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm
@@ -0,0 +1,25 @@
+; Test: ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%100 = OpFunction %void None %2
+%11 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.hlsl b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.hlsl
new file mode 100644
index 0000000..1135368
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.msl b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.spvasm b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.spvasm
new file mode 100644
index 0000000..ca944f0
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.wgsl b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.wgsl
new file mode 100644
index 0000000..471e2a6
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm
new file mode 100644
index 0000000..2bd4643
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm
@@ -0,0 +1,25 @@
+; Test: ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%100 = OpFunction %void None %2
+%11 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.hlsl b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.hlsl
new file mode 100644
index 0000000..1135368
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.msl b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.spvasm b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.spvasm
new file mode 100644
index 0000000..ca944f0
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.wgsl b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.wgsl
new file mode 100644
index 0000000..471e2a6
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm
new file mode 100644
index 0000000..6053a70
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm
@@ -0,0 +1,25 @@
+; Test: ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%100 = OpFunction %void None %2
+%11 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.hlsl b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.hlsl
new file mode 100644
index 0000000..1135368
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.msl b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.spvasm b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.spvasm
new file mode 100644
index 0000000..ca944f0
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.wgsl b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.wgsl
new file mode 100644
index 0000000..471e2a6
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm
new file mode 100644
index 0000000..1df3a9d
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm
@@ -0,0 +1,25 @@
+; Test: ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos SPIR-V Tools Assembler; 0
+; Bound: 101
+; Schema: 0
+OpCapability Shader
+OpMemoryModel Logical Simple
+OpEntryPoint Fragment %100 "main"
+OpExecutionMode %100 OriginUpperLeft
+%void = OpTypeVoid
+%2 = OpTypeFunction %void
+%bool = OpTypeBool
+%uint = OpTypeInt 32 0
+%int = OpTypeInt 32 1
+%float = OpTypeFloat 32
+%v2bool = OpTypeVector %bool 2
+%v2uint = OpTypeVector %uint 2
+%v2int = OpTypeVector %int 2
+%v2float = OpTypeVector %float 2
+%100 = OpFunction %void None %2
+%11 = OpLabel
+OpReturn
+OpFunctionEnd
+
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.hlsl b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.hlsl
new file mode 100644
index 0000000..1135368
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.hlsl
@@ -0,0 +1,8 @@
+void main_1() {
+ return;
+}
+
+void main() {
+ main_1();
+ return;
+}
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.msl b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.msl
new file mode 100644
index 0000000..b0c5c47
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void main_1() {
+ return;
+}
+
+fragment void tint_symbol() {
+ main_1();
+ return;
+}
+
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.spvasm b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.spvasm
new file mode 100644
index 0000000..ca944f0
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.spvasm
@@ -0,0 +1,22 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 8
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main"
+ OpExecutionMode %main OriginUpperLeft
+ OpName %main_1 "main_1"
+ OpName %main "main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %main_1 = OpFunction %void None %1
+ %4 = OpLabel
+ OpReturn
+ OpFunctionEnd
+ %main = OpFunction %void None %1
+ %6 = OpLabel
+ %7 = OpFunctionCall %void %main_1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.wgsl b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.wgsl
new file mode 100644
index 0000000..471e2a6
--- /dev/null
+++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.wgsl
@@ -0,0 +1,8 @@
+fn main_1() {
+ return;
+}
+
+[[stage(fragment)]]
+fn main() {
+ main_1();
+}