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 0000000000..3256180c6f --- /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 0000000000..ac09841d29 --- /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 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 0000000000..fbafb59903 --- /dev/null +++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..917bf8989a --- /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 0000000000..c8535c1e6b --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec4 = 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 0000000000..9535b6726e --- /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 0000000000..1725be256a --- /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 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 0000000000..0dfc65700b --- /dev/null +++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..51a3a4957d --- /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 0000000000..fe8fbb1789 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec4 = 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 0000000000..af1af6b08e --- /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 0000000000..176bcddbf4 --- /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 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 0000000000..97b86f3a4d --- /dev/null +++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..2ed8afb708 --- /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 0000000000..149a246437 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec4 = 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 0000000000..0027fec358 --- /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 0000000000..d3c24fe678 --- /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 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 0000000000..825caa6213 --- /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 + +using namespace metal; +void main_1(texture2d 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 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 0000000000..754bebfc5d --- /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 0000000000..412c09eb5e --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec4 = 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 0000000000..cbf0f8302f --- /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 0000000000..8955379586 --- /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 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 0000000000..f4ed887ef9 --- /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 + +using namespace metal; +void main_1(texture2d 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 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 0000000000..8d9735a510 --- /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 0000000000..502c9b1cc6 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec4 = 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 0000000000..97268dd4ed --- /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 0000000000..23832772fb --- /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 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 0000000000..0ffbcb3e52 --- /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 + +using namespace metal; +void main_1(texture2d 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 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 0000000000..59796e2e13 --- /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 0000000000..b2035a74c2 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec4 = 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 0000000000..96560be6ce --- /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 0000000000..932c9d9913 --- /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 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 0000000000..4375a78a21 --- /dev/null +++ b/test/unittest/reader/spirv/ConvertResultSignedness_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..b9b07e02f7 --- /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 0000000000..472823f211 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec4 = 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 0000000000..73d252c388 --- /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 0000000000..635749289d --- /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 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 0000000000..34f26c704e --- /dev/null +++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture1d 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 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 0000000000..1848be41d9 --- /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 0000000000..0b67cffceb --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..c020aa6222 --- /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 0000000000..00b626175d --- /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 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 0000000000..dab454b6b4 --- /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 + +using namespace metal; +void main_1(texture1d 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 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 0000000000..b47cc8e017 --- /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 0000000000..a236ae0b84 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_71 : vec4 = 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 0000000000..955523e556 --- /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 0000000000..1a33a73316 --- /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 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 0000000000..2f05d2b051 --- /dev/null +++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture1d 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 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 0000000000..4e465fab0f --- /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 0000000000..e4de802f60 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(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 0000000000..902438e71d --- /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 0000000000..9e8165dc2c --- /dev/null +++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..76c637eb15 --- /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 0000000000..dba13191be --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = textureLoad(x_20, vec2(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 0000000000..ae63ba8e7a --- /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 0000000000..6713b54b8c --- /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 + +using namespace metal; +void main_1(texture2d 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 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 0000000000..eee25707a3 --- /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 0000000000..fbe4e1afb9 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_71 : vec4 = textureLoad(x_20, vec2(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 0000000000..d329901ba8 --- /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 0000000000..5c83a3f8c8 --- /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 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 0000000000..5e32b2015b --- /dev/null +++ b/test/unittest/reader/spirv/ConvertUintCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..263b5c452d --- /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 0000000000..ca42d80e10 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + textureStore(x_20, vec2(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 0000000000..96d39ebe12 --- /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 0000000000..5d99a18376 --- /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 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 0000000000..a1ec20a6c2 --- /dev/null +++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture1d 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 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 0000000000..15138de7a5 --- /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 0000000000..193ebee4f5 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..2ad1ba0ff1 --- /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 0000000000..c90be530fd --- /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 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 0000000000..7f21d1c6a9 --- /dev/null +++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture1d 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 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 0000000000..3b16a167ef --- /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 0000000000..ac4b620493 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..1c5a80c6a6 --- /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 0000000000..5d62d421a2 --- /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 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 0000000000..1f1b811c32 --- /dev/null +++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture1d 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 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 0000000000..40a76bed31 --- /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 0000000000..c58533fea9 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..52ba56ed29 --- /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 0000000000..83a57037b6 --- /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 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 0000000000..55676da264 --- /dev/null +++ b/test/unittest/reader/spirv/Good_1D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture1d 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 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 0000000000..f6a1b00f3f --- /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 0000000000..ed286d5755 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..37c619e99e --- /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 0000000000..0b1e681a51 --- /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 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 0000000000..c35f357272 --- /dev/null +++ b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..7645a19f2f --- /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 0000000000..a5f904a523 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..d374779b4d --- /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 0000000000..054600ee95 --- /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 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 0000000000..117ca8f218 --- /dev/null +++ b/test/unittest/reader/spirv/Good_2DArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..4d5a9cb6f4 --- /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 0000000000..5cb51a3eac --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..264d206b2f --- /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 0000000000..e80450b806 --- /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 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 0000000000..0d1252fb49 --- /dev/null +++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..d06503842c --- /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 0000000000..bb63d93828 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..83839ffa47 --- /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 0000000000..ccd77f90d4 --- /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 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 0000000000..e8e4d1fb02 --- /dev/null +++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..4164842cd7 --- /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 0000000000..bc7bd7b79e --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..84f5f58609 --- /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 0000000000..f00cd55bbe --- /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 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 0000000000..68ee2c29c0 --- /dev/null +++ b/test/unittest/reader/spirv/Good_2D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..f290163f68 --- /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 0000000000..d514b6dae5 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..e2f994dc85 --- /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 0000000000..86fbb4f0ed --- /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 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 0000000000..aa96b76649 --- /dev/null +++ b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture3d 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 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 0000000000..2fe350a8b5 --- /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 0000000000..525e45127c --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..6760d0dd6b --- /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 0000000000..b51bc16f99 --- /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 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 0000000000..c199c962a1 --- /dev/null +++ b/test/unittest/reader/spirv/Good_3D_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture3d 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 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 0000000000..245318af96 --- /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 0000000000..309ec34df1 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..f702b8dbd4 --- /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 0000000000..cf2e325277 --- /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 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 0000000000..e47b321b36 --- /dev/null +++ b/test/unittest/reader/spirv/Good_CubeArray_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texturecube_array 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 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 0000000000..5da605ce27 --- /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 0000000000..ab52711b9d --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..47ffffe65c --- /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 0000000000..f180cc3adf --- /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 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 0000000000..f579145d04 --- /dev/null +++ b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texturecube 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 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 0000000000..f087d4b1c4 --- /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 0000000000..a850027d90 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..08cddd0ff9 --- /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 0000000000..3eff8019b3 --- /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 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 0000000000..bbf88bf344 --- /dev/null +++ b/test/unittest/reader/spirv/Good_Cube_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texturecube 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 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 0000000000..73ebb7008d --- /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 0000000000..08cbbd33b8 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..62f3a1915b --- /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 0000000000..276e56d5ad --- /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 0000000000..a98a8d4ab7 --- /dev/null +++ b/test/unittest/reader/spirv/ImageFetch_Depth_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..2da4858e57 --- /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 0000000000..fc8398c293 --- /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 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + let x_99 : vec4 = vec4(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 0000000000..3588dc6870 --- /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 0000000000..5552bb5959 --- /dev/null +++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +Texture2DMS 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 0000000000..ce64fab8a9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_ConvertSampleOperand_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d_ms 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 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 0000000000..11b9e374e3 --- /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 0000000000..e90b685d47 --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + let x_99 : vec4 = 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 0000000000..b47cfe1a8a --- /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 0000000000..12d9a7edfa --- /dev/null +++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +Texture2DMS 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 0000000000..a92b3240fa --- /dev/null +++ b/test/unittest/reader/spirv/ImageFetch_Multisampled_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d_ms 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 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 0000000000..14513e257b --- /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 0000000000..099e81d705 --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + let x_99 : vec4 = 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 0000000000..cc6541c8d0 --- /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 0000000000..7accfe0eec --- /dev/null +++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_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 = 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 0000000000..cadc6e9075 --- /dev/null +++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..d8c95136a4 --- /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 0000000000..4510f1509a --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + let x_99 : vec4 = 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 0000000000..fce9b5cce2 --- /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 0000000000..226a19f26c --- /dev/null +++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.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 = 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 0000000000..6f199b58e9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..c1bde586a9 --- /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 0000000000..d4a286c33b --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + let x_99 : vec4 = 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 0000000000..26f06c1c84 --- /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 0000000000..276e56d5ad --- /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 0000000000..a98a8d4ab7 --- /dev/null +++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..2da4858e57 --- /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 0000000000..fc8398c293 --- /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 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + let x_99 : vec4 = vec4(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 0000000000..dc54cc5d04 --- /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 0000000000..7ebeb96675 --- /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 0000000000..276dc12748 --- /dev/null +++ b/test/unittest/reader/spirv/ImageFetch_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..3f8a1c8287 --- /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 0000000000..5f61e27d16 --- /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 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + let x_99 : vec4 = vec4(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 0000000000..fa78144c00 --- /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 0000000000..a1c275b55c --- /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 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 0000000000..8b4fb7d2ec --- /dev/null +++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..f4b288f857 --- /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 0000000000..1dfacd6193 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..5753ad55f3 --- /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 0000000000..c89ba14527 --- /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 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 0000000000..3ec3e6bd76 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..5dd28cb43b --- /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 0000000000..0f64f8d13a --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..d6b93c4d36 --- /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 0000000000..4b93bd28bc --- /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 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 0000000000..daed0903c5 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture3d 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 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 0000000000..d42a8e9501 --- /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 0000000000..b9f0bf40d5 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..c8d1f589dc --- /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 0000000000..b6bc8de725 --- /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 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 0000000000..f712af00e9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texturecube 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 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 0000000000..258238e660 --- /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 0000000000..9cd57609ef --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..a71769448c --- /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 0000000000..e992e818aa --- /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 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 0000000000..770b9922b5 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texturecube_array 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 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 0000000000..e3f3f680bd --- /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 0000000000..99c8bf42ce --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..c4a7c657af --- /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 0000000000..485be373ba --- /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 0000000000..d86b33e84d --- /dev/null +++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..66f82b067c --- /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 0000000000..a059785cfe --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..f0dbf333d9 --- /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 0000000000..56fc13fbd6 --- /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 0000000000..92dfcc7970 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d_array 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 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 0000000000..23d006ceb3 --- /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 0000000000..f6d61aef1e --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..24589cf57f --- /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 0000000000..39b656f221 --- /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 0000000000..8cbb02d0b9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depthcube 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 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 0000000000..d9342e607c --- /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 0000000000..19ff8ec78e --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..c0c9a06ea4 --- /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 0000000000..27c1534350 --- /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 0000000000..f459c0858c --- /dev/null +++ b/test/unittest/reader/spirv/ImageQueryLevels_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depthcube_array 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 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 0000000000..a8d0d58297 --- /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 0000000000..618b4f627f --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..2ec20cf459 --- /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 0000000000..7442848cc4 --- /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 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 0000000000..d959305c38 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQueryLevels_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..92079d3525 --- /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 0000000000..cde8eeb748 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..e9a3e5d22a --- /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 0000000000..17c6a111ed --- /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 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 0000000000..ceec1f6509 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQuerySamples_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_ms 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 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 0000000000..7cbddbba24 --- /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 0000000000..c2207ded51 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..471db5de81 --- /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 0000000000..d0fc2f3325 --- /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 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 0000000000..7ebdb4a0dd --- /dev/null +++ b/test/unittest/reader/spirv/ImageQuerySamples_UnsignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_ms 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 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 0000000000..67ed2b51ee --- /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 0000000000..03f824f50b --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..1ca187a96b --- /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 0000000000..737b06b78a --- /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 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 0000000000..a995870c15 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..f1cc99f5e9 --- /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 0000000000..7b57d9ad2d --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec3 = vec3(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 0000000000..962f6773e4 --- /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 0000000000..7b21f26b30 --- /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 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 0000000000..765ed45326 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texturecube_array 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 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 0000000000..e3febe50eb --- /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 0000000000..497b8308dd --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec3 = vec3(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 0000000000..aa933a4543 --- /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 0000000000..3192658c74 --- /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 0000000000..7fc9142a79 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d_array 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 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 0000000000..feffb2f97e --- /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 0000000000..362eee8295 --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec3 = vec3(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 0000000000..2c5e1c918b --- /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 0000000000..78f2dd8703 --- /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 0000000000..3134431902 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQuerySizeLod_Arrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depthcube_array 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 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 0000000000..cc25919877 --- /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 0000000000..84671edcae --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec3 = vec3(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 0000000000..3fed4a454b --- /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 0000000000..615507aa88 --- /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 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 0000000000..005045c35f --- /dev/null +++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..3c1a6451e2 --- /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 0000000000..01f8917c28 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec2 = vec2(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 0000000000..5b5cadbe3e --- /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 0000000000..a36cb040a3 --- /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 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 0000000000..29d396e506 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture3d 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 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 0000000000..375680d0b0 --- /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 0000000000..cc23ec1262 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec3 = vec3(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 0000000000..666141db85 --- /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 0000000000..416f283fb8 --- /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 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 0000000000..0332d0e090 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texturecube 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 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 0000000000..44bbb99915 --- /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 0000000000..0aac2b1949 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec2 = vec2(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 0000000000..58d36ec829 --- /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 0000000000..0272d4e03f --- /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 0000000000..a050d72081 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..dcb0fa8eb1 --- /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 0000000000..57e9d2feed --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec2 = vec2(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 0000000000..fadedb003a --- /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 0000000000..45f9b9bd91 --- /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 0000000000..121a49e06c --- /dev/null +++ b/test/unittest/reader/spirv/ImageQuerySizeLod_NonArrayed_SignedResult_SignedLevel_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depthcube 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 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 0000000000..cd2eb75454 --- /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 0000000000..7234972e65 --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec2 = vec2(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 0000000000..5e81a58bee --- /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 0000000000..c9fdb6aacd --- /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 + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..05033408b5 --- /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 0000000000..bbdc71f44d --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec3 = vec3(textureDimensions(x_20), textureNumLayers(x_20)); + let x_98 : vec4 = 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 0000000000..e18febb75f --- /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 0000000000..00208b9202 --- /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 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 0000000000..fb31616278 --- /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 + +using namespace metal; +void main_1(texture2d 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 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 0000000000..b156c3e6bf --- /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 0000000000..66757c0731 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec2 = vec2(textureDimensions(x_20)); + let x_98 : vec4 = 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 0000000000..810f0a4551 --- /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 0000000000..8583b1bc96 --- /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 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 0000000000..32d32d167a --- /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 + +using namespace metal; +void main_1(texture3d 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 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 0000000000..65958226ce --- /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 0000000000..022852aac4 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec3 = vec3(textureDimensions(x_20)); + let x_98 : vec4 = 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 0000000000..73eadc3b3a --- /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 0000000000..34d7716ee0 --- /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 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 0000000000..e20cacfed9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageQuerySize_NonArrayed_SignedResult_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_ms 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 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 0000000000..a6fe6f9044 --- /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 0000000000..b6eed29014 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_99 : vec2 = vec2(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 0000000000..845156e79a --- /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 0000000000..b6074fdbcd --- /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 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 0000000000..eb5b6ad117 --- /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 + +using namespace metal; +void main_1(texture2d 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 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 0000000000..0590182004 --- /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 0000000000..ee058efd1f --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + let x_99 : vec4 = 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 0000000000..c10993de6f --- /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 0000000000..29f4734005 --- /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 0000000000..9487c30a10 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..dcb7022f05 --- /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 0000000000..dc05282771 --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..0d263c02ad --- /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 0000000000..0db5d67d06 --- /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 0000000000..a4ef480a2a --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d_array 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 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 0000000000..c907c3206f --- /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 0000000000..3042bf365a --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..21d4029cf1 --- /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 0000000000..aaea7f7c7e --- /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 0000000000..fb6d7d477c --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..14b94d7661 --- /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 0000000000..1fede99062 --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : f32 = textureSampleCompareLevel(x_20, x_10, coords12, 0.200000003, vec2(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 0000000000..2b3eb9985a --- /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 0000000000..5231fc84be --- /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 0000000000..3093834dc8 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d_array 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 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 0000000000..1a27bc0cc5 --- /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 0000000000..b01094dd8d --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : f32 = textureSampleCompareLevel(x_20, x_10, coords123.xy, i32(coords123.z), 0.200000003, vec2(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 0000000000..523fe16ce6 --- /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 0000000000..1d68927932 --- /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 0000000000..13f98dea3a --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depthcube 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 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 0000000000..addf94024e --- /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 0000000000..6422976193 --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..7e8664770e --- /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 0000000000..7dc9c5f585 --- /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 0000000000..ba834c3885 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depthcube_array 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 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 0000000000..af5c4f02d3 --- /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 0000000000..7ca37e7437 --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..5681efc234 --- /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 0000000000..9a7cc2eab1 --- /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 0000000000..7e9fdfcbfd --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..027911207c --- /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 0000000000..a49497f89b --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..ba70409a03 --- /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 0000000000..4ce5274425 --- /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 0000000000..b3acb6ad87 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d_array 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 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 0000000000..add70aad33 --- /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 0000000000..0f4560d423 --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = 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 0000000000..1c197519c6 --- /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 0000000000..4c3c3d9b4a --- /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 0000000000..33a83c2cdb --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..7e97a13cb8 --- /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 0000000000..6b39daef2c --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : f32 = textureSampleCompare(x_20, x_10, coords12, 0.200000003, vec2(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 0000000000..27d2402c68 --- /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 0000000000..f32518583b --- /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 0000000000..8e79610976 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleDrefImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d_array 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 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 0000000000..17489b57b7 --- /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 0000000000..276e6330e6 --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : f32 = textureSampleCompare(x_20, x_10, coords123.xy, i32(coords123.z), 0.200000003, vec2(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 0000000000..0907d72111 --- /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 0000000000..a7a3154f7f --- /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 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 0000000000..f55dae5dcd --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..327ff1eb24 --- /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 0000000000..aadaa4e4b4 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = 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 0000000000..703decbf80 --- /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 0000000000..925e26a0e8 --- /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 0000000000..2f7ff190ce --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_DepthTexture_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..be082bb684 --- /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 0000000000..090941d212 --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = vec4(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 0000000000..ab0ddace0b --- /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 0000000000..9c6e5042c3 --- /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 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 0000000000..fcc537961d --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..67236c77d7 --- /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 0000000000..fd8a7a632a --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = 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 0000000000..6968656030 --- /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 0000000000..b09b8df330 --- /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 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 0000000000..12a08efb28 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..29ee7b809a --- /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 0000000000..9df3616493 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = 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 0000000000..827d766383 --- /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 0000000000..9c0f1cc797 --- /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 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 0000000000..aa58df73e5 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..83e52c9ac6 --- /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 0000000000..3f066bd04f --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = textureSampleGrad(x_20, x_10, coords12, vf12, vf21, vec2(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 0000000000..5d3f091d29 --- /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 0000000000..d232f37e64 --- /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 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 0000000000..75255792c8 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..8d831c6680 --- /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 0000000000..ce99bdeef2 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = textureSampleGrad(x_20, x_10, coords12, vf12, vf21, vec2(vec2(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 0000000000..644f39c520 --- /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 0000000000..449647a54f --- /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 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 0000000000..404f86e1d0 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..d873c848b1 --- /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 0000000000..36779e22d8 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = textureSampleGrad(x_20, x_10, coords123.xy, i32(coords123.z), vf12, vf21, vec2(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 0000000000..f087b2ca55 --- /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 0000000000..76c0cd01dc --- /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 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 0000000000..b7919d3f04 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingGrad_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..7635bff7c1 --- /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 0000000000..af81b04019 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = textureSampleGrad(x_20, x_10, coords123.xy, i32(coords123.z), vf12, vf21, vec2(vec2(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 0000000000..a8a0f1bbe8 --- /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 0000000000..d5db37cfdf --- /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 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 0000000000..ac80cfb44d --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..e6f3413d03 --- /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 0000000000..59fd0f3b4a --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = 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 0000000000..7d3f9929bf --- /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 0000000000..79643f4f42 --- /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 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 0000000000..818bb026d2 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..cc09c3e552 --- /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 0000000000..3ce4005bfa --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = 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 0000000000..30d486631e --- /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 0000000000..e6113c9a71 --- /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 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 0000000000..c2b4e58d3d --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..8f50fc6004 --- /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 0000000000..78654235b3 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = textureSampleLevel(x_20, x_10, coords12, 0.0, vec2(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 0000000000..6704c595f1 --- /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 0000000000..cb37d6f1e2 --- /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 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 0000000000..95d16812f4 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..ab036fd051 --- /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 0000000000..4bb18fa2cf --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = textureSampleLevel(x_20, x_10, coords12, 0.0, vec2(vec2(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 0000000000..8ff6f59158 --- /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 0000000000..4981065d4b --- /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 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 0000000000..63d9173243 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleExplicitLod_UsingLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..c6caa9bc38 --- /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 0000000000..54de1aea36 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = textureSampleLevel(x_20, x_10, coords123.xy, i32(coords123.z), 0.0, vec2(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 0000000000..18143fac18 --- /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 0000000000..c43b5da9a6 --- /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 0000000000..7a45724778 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_BothDrefAndNonDref_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..95e31fb741 --- /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 0000000000..58da158c54 --- /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 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_200 : vec4 = vec4(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 0000000000..5636069045 --- /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 0000000000..e940f291c0 --- /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 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 0000000000..948a8998b9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..b9b07e02f7 --- /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 0000000000..6be7f3cb46 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = 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 0000000000..c664e99f1f --- /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 0000000000..59431b0f15 --- /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 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 0000000000..1370d88fc8 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..a3319b3b45 --- /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 0000000000..aa9002833d --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = 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 0000000000..8f1e46acce --- /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 0000000000..dfaec94dbc --- /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 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 0000000000..1ddb556472 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..00b89b06a4 --- /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 0000000000..ceb1e1a80b --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = textureSample(x_20, x_10, coords12, vec2(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 0000000000..799b1e499a --- /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 0000000000..555605dcfe --- /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 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 0000000000..62ec1689d9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_3.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..2b8533cff0 --- /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 0000000000..64373e6352 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = textureSample(x_20, x_10, coords123.xy, i32(coords123.z), vec2(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 0000000000..1d9b92f798 --- /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 0000000000..cc97de12ad --- /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 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 0000000000..845974f4d9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..53b54aa16a --- /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 0000000000..45deb93523 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = 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 0000000000..7606396180 --- /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 0000000000..4cce41b526 --- /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 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 0000000000..00f0d6cfb9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_5.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..49c37874f2 --- /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 0000000000..47fc92f5d8 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = 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 0000000000..5ea07b560d --- /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 0000000000..a7fbb8b942 --- /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 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 0000000000..cf3c642ffe --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_6.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..4dbd27c956 --- /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 0000000000..049a22bb1a --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = textureSampleBias(x_20, x_10, coords12, 7.0, vec2(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 0000000000..fa4ccae285 --- /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 0000000000..997c2cbe27 --- /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 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 0000000000..1eb7977ba2 --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_7.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..91ee5bc350 --- /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 0000000000..1545cfd6dd --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = textureSampleBias(x_20, x_10, coords12, 7.0, vec2(vec2(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 0000000000..ba9bbb6502 --- /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 0000000000..f92cc32e76 --- /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 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 0000000000..84633bccac --- /dev/null +++ b/test/unittest/reader/spirv/ImageSampleImplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_8.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..42d0090044 --- /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 0000000000..f3e078c4ac --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf21 : vec2 = vec2(2.0, 1.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let coords1 : f32 = 1.0; + let coords12 : vec2 = vf12; + let coords123 : vec3 = vf123; + let coords1234 : vec4 = vf1234; + let x_79 : vec4 = textureSampleBias(x_20, x_10, coords123.xy, i32(coords123.z), 7.0, vec2(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 0000000000..173b4ef374 --- /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 0000000000..fd04635878 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..d1812a1453 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..43b2122da3 --- /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 0000000000..0e65cd96b9 --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + textureStore(x_20, vi12, vec4(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 0000000000..2c635451bc --- /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 0000000000..11dee90661 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..52da7f5769 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..2dbce189c3 --- /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 0000000000..00f5da685b --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + textureStore(x_20, vi12, vec4(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 0000000000..ffe48bc1ad --- /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 0000000000..ae87f190aa --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..04ec3b1810 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_2.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..545d47266d --- /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 0000000000..831db1a9ab --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + textureStore(x_20, vi12, vec4(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 0000000000..7cc2494a5c --- /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 0000000000..247c8168ec --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..9df1b411c9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_3.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..74da5a39ef --- /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 0000000000..1a90a891e8 --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(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 0000000000..228dd41993 --- /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 0000000000..11dee90661 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..52da7f5769 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_4.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..48172e2979 --- /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 0000000000..11e28a6c84 --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + textureStore(x_20, vi12, vec4(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 0000000000..1501e622c9 --- /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 0000000000..ae87f190aa --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..04ec3b1810 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_5.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..643e924fae --- /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 0000000000..66c3140ca8 --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + textureStore(x_20, vi12, vec4(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 0000000000..aefe7fcc7f --- /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 0000000000..247c8168ec --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..9df1b411c9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_6.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..630dc28623 --- /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 0000000000..7b752c796a --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(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 0000000000..66a503c9f0 --- /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 0000000000..247c8168ec --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..9df1b411c9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Arity_SpvParserHandleTest_ImageAccessTest_Variable_7.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..56c5392bff --- /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 0000000000..d0c05f4e63 --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(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 0000000000..afbefb9e6e --- /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 0000000000..e3e7108624 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..ffcc7eb845 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..75f775e25d --- /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 0000000000..dbddd5b9f2 --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(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 0000000000..9f6444eb8a --- /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 0000000000..3a143b1afa --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..4c3c05b523 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_SameSignedness_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..0951fe56da --- /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 0000000000..99f8aeaa7d --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(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 0000000000..e8649430d8 --- /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 0000000000..0b05d8750d --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..2935498e78 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..2621eb7a3c --- /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 0000000000..71e539df3c --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + textureStore(x_20, vi12, vec4(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 0000000000..c28415b15b --- /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 0000000000..1e8418097b --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..7d520f0ab8 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_ConvertTexelOperand_Signedness_AndWidening_SpvParserHandleTest_ImageAccessTest_Variable_1.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..9ea95345a9 --- /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 0000000000..ba6ec4844d --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(3, 4); + textureStore(x_20, vi12, vec4(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 0000000000..7fbbf93393 --- /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 0000000000..247c8168ec --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.hlsl @@ -0,0 +1,24 @@ +RWTexture2D 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 0000000000..9df1b411c9 --- /dev/null +++ b/test/unittest/reader/spirv/ImageWrite_OptionalParams_SpvParserHandleTest_ImageAccessTest_Variable_0.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..56c5392bff --- /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 0000000000..d0c05f4e63 --- /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; + +fn main_1() { + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let offsets2d : vec2 = vec2(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 0000000000..103bb3d3d2 --- /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 0000000000..bc1d9f018d --- /dev/null +++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.hlsl @@ -0,0 +1,10 @@ +Texture1D 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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..8313226373 --- /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 0000000000..aae3c194f1 --- /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; + +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 0000000000..57870aa71f --- /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 0000000000..bc1d9f018d --- /dev/null +++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.hlsl @@ -0,0 +1,10 @@ +Texture1D 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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_1.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..e27fc57be0 --- /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 0000000000..0cd90147f2 --- /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; + +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 0000000000..96cf0cf6f5 --- /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 0000000000..8f1936bf44 --- /dev/null +++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.hlsl @@ -0,0 +1,10 @@ +RWTexture1D 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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/Images_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_2.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..d534af71b7 --- /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 0000000000..5f7b40a35f --- /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; + +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 0000000000..2e5fd8c68a --- /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 0000000000..675bb94ea8 --- /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 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 0000000000..9986bb62a3 --- /dev/null +++ b/test/unittest/reader/spirv/Multisampled_Only2DNonArrayedIsValid_SpvParserHandleTest_ImageDeclTest_DeclareAndUseHandle_2.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d_ms 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 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 0000000000..99757d07f6 --- /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 0000000000..a79ff6042e --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(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 0000000000..c810e7c1c2 --- /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 0000000000..0b1e681a51 --- /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 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 0000000000..c35f357272 --- /dev/null +++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..7645a19f2f --- /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 0000000000..a5f904a523 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..ce27ad05bb --- /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 0000000000..0a0812e8bb --- /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 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 0000000000..115552a11c --- /dev/null +++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..c2ba1358a9 --- /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 0000000000..3e2748d2cf --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..16cadc91db --- /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 0000000000..63be007570 --- /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 0000000000..433bf896f6 --- /dev/null +++ b/test/unittest/reader/spirv/PreserveFloatCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(depth2d_array 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 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 0000000000..70122c915b --- /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 0000000000..af05101585 --- /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 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(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 0000000000..b53b3aa90b --- /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 0000000000..5d99a18376 --- /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 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 0000000000..a1ec20a6c2 --- /dev/null +++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture1d 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 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 0000000000..15138de7a5 --- /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 0000000000..193ebee4f5 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..8df911c3cc --- /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 0000000000..e80450b806 --- /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 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 0000000000..0d1252fb49 --- /dev/null +++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..d06503842c --- /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 0000000000..bb63d93828 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..baacd1b2e7 --- /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 0000000000..8cfe6f4725 --- /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 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 0000000000..3bb2499599 --- /dev/null +++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..16c8bf6f4d --- /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 0000000000..f5408be01f --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..5e0cc22893 --- /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 0000000000..e89c169b34 --- /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 0000000000..c8f870df6f --- /dev/null +++ b/test/unittest/reader/spirv/PreserveFloatCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_4.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..d88517ec9b --- /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 0000000000..fc93a1704a --- /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 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(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 0000000000..081d7246ff --- /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 0000000000..6f308d5a19 --- /dev/null +++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..a9b420a53d --- /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 0000000000..b695621df5 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..4a06b79c6b --- /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 0000000000..f1e2f5b7b9 --- /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 + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..74200f2bab --- /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 0000000000..41b4743eee --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_71 : vec4 = 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 0000000000..806dbc187f --- /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 0000000000..6b702c0328 --- /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 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 0000000000..fd02394717 --- /dev/null +++ b/test/unittest/reader/spirv/PreserveIntCoords_Arrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d_array 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 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 0000000000..9b7d6093b8 --- /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 0000000000..c57e52c9c1 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(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 0000000000..74f95e1f84 --- /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 0000000000..66bd7b162f --- /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 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 0000000000..114e6a650b --- /dev/null +++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture1d 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 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 0000000000..80160fc7a7 --- /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 0000000000..67965cc411 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..976b6a399d --- /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 0000000000..4e14e7bb36 --- /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 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 0000000000..63947deab0 --- /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 + +using namespace metal; +void main_1(texture1d 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 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 0000000000..92691a277c --- /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 0000000000..4877caa158 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_71 : vec4 = 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 0000000000..85af78d3fb --- /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 0000000000..d337988449 --- /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 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 0000000000..8c9200b26e --- /dev/null +++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_2.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture1d 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 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 0000000000..97b34b3ad8 --- /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 0000000000..baaf43c56a --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(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 0000000000..b612863e98 --- /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 0000000000..b7ff9fdcb9 --- /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 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 0000000000..b558cba23c --- /dev/null +++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_3.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..b3d48480ac --- /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 0000000000..5fdecc4911 --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_73 : vec4 = 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 0000000000..15d6b83af5 --- /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 0000000000..cac017971d --- /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 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 0000000000..e34199f3cb --- /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 + +using namespace metal; +void main_1(texture2d 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 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 0000000000..bd3810fe60 --- /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 0000000000..3eb6605e7b --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + let x_71 : vec4 = 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 0000000000..0b32cb6d3a --- /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 0000000000..d6a908018c --- /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 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 0000000000..7fdda0e718 --- /dev/null +++ b/test/unittest/reader/spirv/PreserveIntCoords_NonArrayed_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_5.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..8fff5dd2cf --- /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 0000000000..322a9bfebc --- /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; + +[[group(0), binding(1)]] var x_30 : sampler; + +fn main_1() { + var float_var : f32; + let i1 : i32 = 1; + let vi12 : vec2 = vec2(1, 2); + let vi123 : vec3 = vec3(1, 2, 3); + let vi1234 : vec4 = vec4(1, 2, 3, 4); + let u1 : u32 = 1u; + let vu12 : vec2 = vec2(1u, 2u); + let vu123 : vec3 = vec3(1u, 2u, 3u); + let vu1234 : vec4 = vec4(1u, 2u, 3u, 4u); + let f1 : f32 = 1.0; + let vf12 : vec2 = vec2(1.0, 2.0); + let vf123 : vec3 = vec3(1.0, 2.0, 3.0); + let vf1234 : vec4 = vec4(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 0000000000..bd867dd134 --- /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 0000000000..6de43b216c --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/Samplers_SpvParserHandleTest_DeclUnderspecifiedHandle_Variable_0.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..2fb8878cf6 --- /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 0000000000..a564925663 --- /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 0000000000..315d47ea5c --- /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 0000000000..f496a7d198 --- /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 0000000000..7e7cc9a2db --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..9e443ff642 --- /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 0000000000..e8774367e5 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_0.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..68c3ef1de8 --- /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 0000000000..983314b893 --- /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 0000000000..d6228c70ae --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..230fe6aeb7 --- /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 0000000000..325c2c58a0 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_1.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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(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 0000000000..6c78f2055f --- /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 0000000000..ab2e231851 --- /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 0000000000..b153c9ec77 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..9e60c0ed38 --- /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 0000000000..d28718762d --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_2.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : vec3; + +fn main_1() { + let x_2 : vec3 = x_1; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(local_invocation_id)]] x_1_param : vec3) { + 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 0000000000..b08cc3e7d8 --- /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 0000000000..9b5b8cc5cf --- /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 0000000000..bdf373b670 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..d489e17bd7 --- /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 0000000000..d5f74d9293 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_3.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : vec3; + +fn main_1() { + let x_2 : vec3 = x_1; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(local_invocation_id)]] x_1_param : vec3) { + x_1 = bitcast>(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 0000000000..1843c3f3dc --- /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 0000000000..1808399df2 --- /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 0000000000..b63600657f --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..aedb68e53d --- /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 0000000000..eb4dd00e67 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_4.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : vec3; + +fn main_1() { + let x_2 : vec3 = x_1; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_1_param : vec3) { + 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 0000000000..30486579da --- /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 0000000000..4c89479d85 --- /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 0000000000..98f26ba0ff --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..333a5bcbfe --- /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 0000000000..f57b424c84 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_5.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : vec3; + +fn main_1() { + let x_2 : vec3 = x_1; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_1_param : vec3) { + x_1 = bitcast>(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 0000000000..9a6b2c6824 --- /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 0000000000..737d636cb9 --- /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 0000000000..7ccca66e32 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..8cb0f37660 --- /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 0000000000..c68c220257 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_6.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : vec3; + +fn main_1() { + let x_2 : vec3 = x_1; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(workgroup_id)]] x_1_param : vec3) { + 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 0000000000..7d53f559b3 --- /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 0000000000..8dfa3752af --- /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 0000000000..6cee654587 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..fbeffa52fc --- /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 0000000000..ef7e659b9f --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_AccessChain_7.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : vec3; + +fn main_1() { + let x_2 : vec3 = x_1; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(workgroup_id)]] x_1_param : vec3) { + x_1 = bitcast>(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 0000000000..a5c4fab3c8 --- /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 0000000000..f496a7d198 --- /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 0000000000..7e7cc9a2db --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..9e443ff642 --- /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 0000000000..768c1fad98 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_0.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var x_1 : u32; + +fn main_1() { + let x_13 : ptr = &(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 0000000000..87a25a97ee --- /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 0000000000..983314b893 --- /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 0000000000..d6228c70ae --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..230fe6aeb7 --- /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 0000000000..e96cecc6ad --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_1.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var x_1 : i32; + +fn main_1() { + let x_13 : ptr = &(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(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 0000000000..a6ebede4ac --- /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 0000000000..ab2e231851 --- /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 0000000000..b153c9ec77 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..9e60c0ed38 --- /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 0000000000..219224d51f --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_2.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var x_1 : vec3; + +fn main_1() { + let x_13 : ptr> = &(x_1); + let x_2 : vec3 = *(x_13); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(local_invocation_id)]] x_1_param : vec3) { + 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 0000000000..0dceb7cd85 --- /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 0000000000..9b5b8cc5cf --- /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 0000000000..bdf373b670 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..d489e17bd7 --- /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 0000000000..c4a03f98a2 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_3.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var x_1 : vec3; + +fn main_1() { + let x_13 : ptr> = &(x_1); + let x_2 : vec3 = *(x_13); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(local_invocation_id)]] x_1_param : vec3) { + x_1 = bitcast>(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 0000000000..f36df5a30c --- /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 0000000000..1808399df2 --- /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 0000000000..b63600657f --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..aedb68e53d --- /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 0000000000..92c5c3b57c --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_4.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var x_1 : vec3; + +fn main_1() { + let x_13 : ptr> = &(x_1); + let x_2 : vec3 = *(x_13); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_1_param : vec3) { + 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 0000000000..cc6e514afb --- /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 0000000000..4c89479d85 --- /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 0000000000..98f26ba0ff --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..333a5bcbfe --- /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 0000000000..679d802767 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_5.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var x_1 : vec3; + +fn main_1() { + let x_13 : ptr> = &(x_1); + let x_2 : vec3 = *(x_13); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_1_param : vec3) { + x_1 = bitcast>(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 0000000000..8ce8fbae6a --- /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 0000000000..737d636cb9 --- /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 0000000000..7ccca66e32 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..8cb0f37660 --- /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 0000000000..862a3227da --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_6.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var x_1 : vec3; + +fn main_1() { + let x_13 : ptr> = &(x_1); + let x_2 : vec3 = *(x_13); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(workgroup_id)]] x_1_param : vec3) { + 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 0000000000..a4a60d6340 --- /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 0000000000..8dfa3752af --- /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 0000000000..6cee654587 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..fbeffa52fc --- /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 0000000000..e60015af6b --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_CopyObject_7.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var x_1 : vec3; + +fn main_1() { + let x_13 : ptr> = &(x_1); + let x_2 : vec3 = *(x_13); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(workgroup_id)]] x_1_param : vec3) { + x_1 = bitcast>(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 0000000000..7f312fe792 --- /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 0000000000..f496a7d198 --- /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 0000000000..7e7cc9a2db --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..9e443ff642 --- /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 0000000000..e8774367e5 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_0.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..13cb937770 --- /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 0000000000..983314b893 --- /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 0000000000..d6228c70ae --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..230fe6aeb7 --- /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 0000000000..325c2c58a0 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_1.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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(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 0000000000..9b6ef51fdc --- /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 0000000000..ab2e231851 --- /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 0000000000..b153c9ec77 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..9e60c0ed38 --- /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 0000000000..d28718762d --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_2.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : vec3; + +fn main_1() { + let x_2 : vec3 = x_1; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(local_invocation_id)]] x_1_param : vec3) { + 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 0000000000..fa9cae1fea --- /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 0000000000..9b5b8cc5cf --- /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 0000000000..bdf373b670 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..d489e17bd7 --- /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 0000000000..d5f74d9293 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_3.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : vec3; + +fn main_1() { + let x_2 : vec3 = x_1; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(local_invocation_id)]] x_1_param : vec3) { + x_1 = bitcast>(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 0000000000..20a177fa16 --- /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 0000000000..1808399df2 --- /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 0000000000..b63600657f --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..aedb68e53d --- /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 0000000000..eb4dd00e67 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_4.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : vec3; + +fn main_1() { + let x_2 : vec3 = x_1; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_1_param : vec3) { + 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 0000000000..c7c748af59 --- /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 0000000000..4c89479d85 --- /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 0000000000..98f26ba0ff --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..333a5bcbfe --- /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 0000000000..f57b424c84 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_5.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : vec3; + +fn main_1() { + let x_2 : vec3 = x_1; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(global_invocation_id)]] x_1_param : vec3) { + x_1 = bitcast>(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 0000000000..254864e70b --- /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 0000000000..737d636cb9 --- /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 0000000000..7ccca66e32 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..8cb0f37660 --- /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 0000000000..c68c220257 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_6.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : vec3; + +fn main_1() { + let x_2 : vec3 = x_1; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(workgroup_id)]] x_1_param : vec3) { + 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 0000000000..5e1b256cd5 --- /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 0000000000..8dfa3752af --- /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 0000000000..6cee654587 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..fbeffa52fc --- /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 0000000000..ef7e659b9f --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvModuleScopeVarParserTest_ComputeBuiltin_Load_Direct_7.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : vec3; + +fn main_1() { + let x_2 : vec3 = x_1; + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main([[builtin(workgroup_id)]] x_1_param : vec3) { + x_1 = bitcast>(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 0000000000..cc1ad603e6 --- /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 0000000000..071b671770 --- /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 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 0000000000..7efcaaff1a --- /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 + +using namespace metal; +void main_1(texture1d tint_symbol_1) { + float4 const x_125 = tint_symbol_1.read(uint(int(1u))); + return; +} + +fragment void tint_symbol(texture1d 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 0000000000..b6cb9e71d7 --- /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 0000000000..6339b4fdeb --- /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; + +fn main_1() { + let x_125 : vec4 = 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 0000000000..2205dfae5d --- /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 0000000000..8486152943 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.hlsl @@ -0,0 +1,11 @@ +RWTexture1D 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 0000000000..c2a8c6d941 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1(texture1d 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 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 0000000000..950da1cb9f --- /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 0000000000..3a825badd9 --- /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; + +fn main_1() { + textureStore(x_20, i32(1u), vec4(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 0000000000..5a58e6d7c4 --- /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 0000000000..e4acdba1ef --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.hlsl @@ -0,0 +1,11 @@ +Texture1D 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 0000000000..67e007ff0c --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1(texture1d tint_symbol_1) { + float4 const x_125 = tint_symbol_1.read(uint(int(0u)), 0); + return; +} + +fragment void tint_symbol(texture1d 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 0000000000..ec825f0481 --- /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 0000000000..e6a759aae2 --- /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; + +fn main_1() { + let x_125 : vec4 = 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 0000000000..01ed012c4d --- /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 0000000000..edb38d59c6 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.hlsl @@ -0,0 +1,13 @@ +Texture2D 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 0000000000..cf03d7899a --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..855359c746 --- /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 0000000000..4029efea76 --- /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; + +fn main_1() { + let x_125 : vec2 = vec2(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 0000000000..9087dac00e --- /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 0000000000..11ad13cea2 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.hlsl @@ -0,0 +1,13 @@ +Texture2D 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 0000000000..cf24ad6abf --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..5f31a30753 --- /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 0000000000..b7e8c34c42 --- /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; + +fn main_1() { + let x_125 : vec2 = vec2(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 0000000000..e69c92102a --- /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 0000000000..9abae08711 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.hlsl @@ -0,0 +1,13 @@ +Texture2D 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 0000000000..cbbdada515 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1(texture2d tint_symbol_1) { + uint const x_125 = uint(int(tint_symbol_1.get_num_mip_levels())); + return; +} + +fragment void tint_symbol(texture2d 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 0000000000..fcc8849439 --- /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 0000000000..3c794d71f4 --- /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; + +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 0000000000..746d8d9e6d --- /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 0000000000..903865a30c --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.hlsl @@ -0,0 +1,13 @@ +Texture2DMS 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 0000000000..e9ec103077 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_RawImage_Variable_6.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1(texture2d_ms tint_symbol_1) { + uint const x_125 = uint(int(tint_symbol_1.get_num_samples())); + return; +} + +fragment void tint_symbol(texture2d_ms 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 0000000000..9ea81a18fe --- /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 0000000000..9575cb56a2 --- /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; + +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 0000000000..70480df7fb --- /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 0000000000..c65283caba --- /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 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 0000000000..2994e9c2a6 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..e1bce557dc --- /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 0000000000..a19e4a9089 --- /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; + +fn main_1() { + let x_131 : vec4 = textureSample(x_20, x_10, vec2(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 0000000000..63ea3fae26 --- /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 0000000000..a099f4c28c --- /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 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 0000000000..72e2824702 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..3c11baf8a8 --- /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 0000000000..5e6d650804 --- /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; + +fn main_1() { + let x_131 : vec4 = textureSampleLevel(x_20, x_10, vec2(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 0000000000..a0aa50bc94 --- /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 0000000000..b780a1759c --- /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 0000000000..ab2c89015a --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1(depth2d 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 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 0000000000..973dbf752e --- /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 0000000000..b8630ae69f --- /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(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 0000000000..33c29ae881 --- /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 0000000000..f5d101b9d6 --- /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 0000000000..e11c628554 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..c9e44e8818 --- /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 0000000000..e69479f799 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..aa3b6f263d --- /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 0000000000..603ec91e4e --- /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 0000000000..71bfdcf8c4 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..f35a8291eb --- /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 0000000000..fbe54ffeac --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..42e3c3788e --- /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 0000000000..bb71e730ba --- /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 0000000000..314fb7c927 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_2.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..f9adb2b0b7 --- /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 0000000000..3c03ebe910 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..a10a6560d2 --- /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 0000000000..602213c3f2 --- /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 0000000000..4fd52941ce --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_3.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..cec3063ffa --- /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 0000000000..2fb416bb10 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..9aeeb289c6 --- /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 0000000000..b7cb4e530f --- /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 0000000000..2326c08687 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataPacking_Valid_4.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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(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 0000000000..697a638d2b --- /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 0000000000..80383a4470 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..4f44266810 --- /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 0000000000..119835a9c0 --- /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 0000000000..3db4e59148 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..87fd4293f9 --- /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 0000000000..802d8c962b --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec4 = 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 0000000000..490f159b59 --- /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 0000000000..ae9fc1c40c --- /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 0000000000..17fdac6745 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..2a9d4ce1a7 --- /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 0000000000..6fcb6a9e82 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec4 = 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 0000000000..a8ba407186 --- /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 0000000000..bc0d022c5b --- /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 0000000000..cbcf5ebdb3 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_2.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..441d49c948 --- /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 0000000000..c6677a5b95 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..f9a9fc5a81 --- /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 0000000000..4f72aff84b --- /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 0000000000..11a05dd0ac --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_3.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..9a062b919c --- /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 0000000000..a4b1e14dcd --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..6a35e2c3a6 --- /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 0000000000..4e67d7d874 --- /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 0000000000..a56289b92d --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_DataUnpacking_Valid_4.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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(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 0000000000..8cc47a88aa --- /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 0000000000..f1b3b1fc9b --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..ba524e8d6b --- /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 0000000000..5eb9727f6a --- /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 0000000000..d05ff1f6fd --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float3_Float3Float3_Samples_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..67ec16bb41 --- /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 0000000000..794ced9cd9 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec3 = 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 0000000000..46bcd39449 --- /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 0000000000..ee7e7daddd --- /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 0000000000..238245e44b --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Scalar_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..3ce85f103f --- /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 0000000000..6b350f09f9 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..292f3e8aed --- /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 0000000000..26bb202bc1 --- /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 0000000000..093539e3fc --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_FloatingFloating_Vector_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..1d4adf49e7 --- /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 0000000000..a0f52d6e93 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..e59693c503 --- /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 0000000000..a8f6e4acb0 --- /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 0000000000..4ac5f38ff4 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Scalar_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..05663ec6fa --- /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 0000000000..79afbe1e53 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..a7e6873189 --- /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 0000000000..167d0d81f2 --- /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 0000000000..0b9b36d513 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Float_Floating_Vector_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..2306f2dc1d --- /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 0000000000..b0351b5642 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..8c19bda76d --- /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 0000000000..eeae052a23 --- /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 0000000000..401988b038 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..d5b56f12ea --- /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 0000000000..2c8272f7bc --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..bb606fa062 --- /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 0000000000..eeae052a23 --- /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 0000000000..401988b038 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..d5b56f12ea --- /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 0000000000..2c8272f7bc --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..3221f4b7c1 --- /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 0000000000..d2234d1399 --- /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 0000000000..007fa77734 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_2.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..aa0d13ca6c --- /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 0000000000..d4cb31367c --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..e4feec8b42 --- /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 0000000000..6281d7d70e --- /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 0000000000..a704b23edc --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_3.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..a75d944afa --- /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 0000000000..0c904b8f83 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..5ac4bba33f --- /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 0000000000..31d3f7ff89 --- /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 0000000000..6f931cd55f --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Scalar_4.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..38c9cc06d6 --- /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 0000000000..3888f75863 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..5b9c2b9387 --- /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 0000000000..f06a436e30 --- /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 0000000000..16834506e2 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..ec15f9f03f --- /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 0000000000..a0890eba05 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..80748fcac4 --- /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 0000000000..f06a436e30 --- /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 0000000000..16834506e2 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..ec15f9f03f --- /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 0000000000..a0890eba05 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..96ad300799 --- /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 0000000000..8bf65344b3 --- /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 0000000000..a622bcb606 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_2.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..0b93ffd58b --- /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 0000000000..5d16362464 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..ec10088007 --- /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 0000000000..5e0fe7bd9f --- /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 0000000000..323a427f14 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_3.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..0c07d32643 --- /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 0000000000..6d2e82e80a --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..25ae8ebde4 --- /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 0000000000..a65e391186 --- /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 0000000000..546d4d6420 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating_Vector_4.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..c4062baea6 --- /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 0000000000..66a46c5792 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..043d37b8ee --- /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 0000000000..233702545c --- /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 0000000000..8fb8a80752 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..8d1f6d7180 --- /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 0000000000..f98852d33b --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..4e00534322 --- /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 0000000000..b336ec588c --- /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 0000000000..ac90c5f702 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..1dfa7a6757 --- /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 0000000000..add72a2201 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..743c005fb3 --- /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 0000000000..795e9bab07 --- /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 0000000000..eaaa317208 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_2.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..8cf51cbf32 --- /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 0000000000..91dbf8eca9 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..402a596cd7 --- /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 0000000000..b336ec588c --- /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 0000000000..ac90c5f702 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_3.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..1dfa7a6757 --- /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 0000000000..add72a2201 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..d00edc23f5 --- /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 0000000000..795e9bab07 --- /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 0000000000..eaaa317208 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_4.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..8cf51cbf32 --- /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 0000000000..91dbf8eca9 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..a668d3011b --- /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 0000000000..d637bbc6c2 --- /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 0000000000..f243db3ce5 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_5.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..723f92063f --- /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 0000000000..0e1f2abf4c --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..b408d16465 --- /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 0000000000..2b9bea6cdc --- /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 0000000000..5d51e7692a --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Scalar_6.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..c2f07fe84d --- /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 0000000000..4c5a1b55b1 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..951c786742 --- /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 0000000000..e3cc1fe926 --- /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 0000000000..a380d9c022 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..908222e9fb --- /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 0000000000..30dff65e18 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..8ddd293305 --- /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 0000000000..ba378fd0b1 --- /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 0000000000..e197300873 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..a6309d5626 --- /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 0000000000..4b3483106b --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..f01ad2a60f --- /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 0000000000..95069c1f6b --- /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 0000000000..d23ae08ebe --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_2.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..2692f6fc04 --- /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 0000000000..816369de80 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..ef164ebada --- /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 0000000000..ba378fd0b1 --- /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 0000000000..e197300873 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_3.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..a6309d5626 --- /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 0000000000..4b3483106b --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..47798a01ff --- /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 0000000000..95069c1f6b --- /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 0000000000..d23ae08ebe --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_4.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..2692f6fc04 --- /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 0000000000..816369de80 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..1d715c5ea3 --- /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 0000000000..c99efcfecc --- /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 0000000000..ec149a3214 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_5.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..01b26692a3 --- /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 0000000000..14c8c1d116 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..fdb8a466b1 --- /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 0000000000..6dd1cc8372 --- /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 0000000000..999dc50d00 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingFloating_Vector_6.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..687e3b041e --- /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 0000000000..cf8872bc4a --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..20493e8c75 --- /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 0000000000..876d281ecc --- /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 0000000000..56622e83c5 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Scalar_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..28f401d3d8 --- /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 0000000000..6a6e44599c --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..c417c1ba59 --- /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 0000000000..49d65b975b --- /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 0000000000..7f4b9183c3 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingInting_Vector_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..13c02b539f --- /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 0000000000..70e623e37f --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..326ffa2821 --- /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 0000000000..a889e7888b --- /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 0000000000..9484ddac44 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Scalar_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..2eab6d45b1 --- /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 0000000000..45e078423c --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..03cbec2b44 --- /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 0000000000..896884350a --- /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 0000000000..937bf3d103 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_FloatingUinting_Vector_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..69e8594ecf --- /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 0000000000..100a2a971e --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = ldexp(v2f1, vec2(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 0000000000..644826cd66 --- /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 0000000000..505499ff7b --- /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 0000000000..532fd4e8ca --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..1f36b25b41 --- /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 0000000000..8dc247750e --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..2154a08ae4 --- /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 0000000000..c49973bd7f --- /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 0000000000..13e07e7a1a --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..c9db4ff750 --- /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 0000000000..50556c90d5 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..aacff863a5 --- /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 0000000000..5851103f22 --- /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 0000000000..48e0ad9fcd --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_10.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..9c27eb95b3 --- /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 0000000000..5db5f20223 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..5a71d5346e --- /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 0000000000..ef9bbc9123 --- /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 0000000000..0795995065 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_11.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..b95a0db9bf --- /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 0000000000..2d34c5ccba --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..805437caad --- /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 0000000000..9b022feddb --- /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 0000000000..c7910f2c8e --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_12.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..6b6df66511 --- /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 0000000000..ab280a6263 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..57d8fdacf0 --- /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 0000000000..e2f4cbe4bd --- /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 0000000000..9c67337fc9 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_13.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..0e6037c81b --- /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 0000000000..0223a9eceb --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..9dba2c6b1b --- /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 0000000000..ac39225821 --- /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 0000000000..a2c3822f25 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_14.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..7f8fc7cbd6 --- /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 0000000000..07aa82bc68 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..48594ed9a6 --- /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 0000000000..4b2ecb17b9 --- /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 0000000000..1a3715176f --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_15.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..06f3802299 --- /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 0000000000..24859ef1cf --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..32d07766ce --- /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 0000000000..4b2ecb17b9 --- /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 0000000000..1a3715176f --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_16.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..06f3802299 --- /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 0000000000..24859ef1cf --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..487388cbab --- /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 0000000000..95a2b2c1b5 --- /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 0000000000..4a19e7c0b3 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_17.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..5d2796795f --- /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 0000000000..090ba0e79d --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..74aa8e5f76 --- /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 0000000000..2a30ec3dcf --- /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 0000000000..ab34002df4 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_18.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..f6b5725d2a --- /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 0000000000..6038ab187f --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..0594ace56e --- /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 0000000000..ad23fb5199 --- /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 0000000000..58cca00aac --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_19.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..73900b4c76 --- /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 0000000000..f6b726f394 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..60e094f5d0 --- /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 0000000000..4c441f5e9c --- /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 0000000000..a34ad6e86f --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_2.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..aa4a093d7f --- /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 0000000000..8afd315685 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..95f49c1884 --- /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 0000000000..b50f17c37f --- /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 0000000000..c0266db31d --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_20.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..fef4710d37 --- /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 0000000000..37c4b39336 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..3fe84b3911 --- /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 0000000000..e558c3792f --- /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 0000000000..134e6a5504 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_21.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..19d1f47062 --- /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 0000000000..b4ae34624e --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..539da88e6e --- /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 0000000000..4562c25a09 --- /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 0000000000..8c80b009e8 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_22.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..ec22daefca --- /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 0000000000..5bfb997593 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..5671bac369 --- /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 0000000000..a3321b9bea --- /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 0000000000..4d42251cfa --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_3.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..731cfb5e35 --- /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 0000000000..be4ceb2efd --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..6cf28da23b --- /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 0000000000..02eb11a3d8 --- /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 0000000000..b22344f269 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_4.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..60c270586e --- /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 0000000000..ca8637cb6b --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..e394bd7a1e --- /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 0000000000..71470f4145 --- /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 0000000000..c4dcb4eee8 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_5.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..c70835d567 --- /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 0000000000..802e5d3bfc --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..5a08061ebb --- /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 0000000000..26092f7be6 --- /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 0000000000..2e89ac46ec --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_6.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..47c6f20db0 --- /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 0000000000..bf702a3956 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..92daf76712 --- /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 0000000000..5f2e11a3d6 --- /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 0000000000..e31b33f434 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_7.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..41553ce7db --- /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 0000000000..82a960ad15 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..510d71c2c8 --- /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 0000000000..4900be4084 --- /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 0000000000..4ac5f38ff4 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_8.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..e78343c0d4 --- /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 0000000000..7589973b5f --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..89201023ad --- /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 0000000000..f1df3b771d --- /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 0000000000..44f824512a --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Scalar_9.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..26bd8454d8 --- /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 0000000000..70f3873d84 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..cf079c5110 --- /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 0000000000..321b64ce40 --- /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 0000000000..0c9a877a78 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..a7d719493d --- /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 0000000000..deac85634e --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..c39a977d40 --- /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 0000000000..1a801121f9 --- /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 0000000000..01ab346197 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..0664b100d3 --- /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 0000000000..358bdd6e31 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..fe04d873cb --- /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 0000000000..a080366f1f --- /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 0000000000..eb9416fdb8 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_10.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..aa27ff4134 --- /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 0000000000..91cfb3df6d --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..6839dec88d --- /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 0000000000..d4b6ff7807 --- /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 0000000000..b179f70d55 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_11.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..b4b13eeff7 --- /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 0000000000..2e14f7696e --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..3c14e2b931 --- /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 0000000000..47fe07faa5 --- /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 0000000000..99db3c2dd3 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_12.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..f87d3abeca --- /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 0000000000..177941ed67 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..638ad92226 --- /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 0000000000..d51a664ff3 --- /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 0000000000..9c033ad715 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_13.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..0ea92cce13 --- /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 0000000000..b136a0f562 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..28bb4da8ee --- /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 0000000000..b4f49f62a2 --- /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 0000000000..eab849b993 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_14.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..68a5d86532 --- /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 0000000000..6adbf967ed --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..ac99496ba0 --- /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 0000000000..b33a1bbf38 --- /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 0000000000..51d1956dee --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_15.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..87c4d05b99 --- /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 0000000000..d2f6d19c2f --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..3ca868a754 --- /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 0000000000..b33a1bbf38 --- /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 0000000000..51d1956dee --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_16.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..87c4d05b99 --- /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 0000000000..d2f6d19c2f --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..9b34c16aa4 --- /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 0000000000..1c67f46dd2 --- /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 0000000000..4cc0ef1756 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_17.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..7f5e16dceb --- /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 0000000000..bdea50dae3 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..c6901db366 --- /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 0000000000..44a46d2166 --- /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 0000000000..34c9fbda34 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_18.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..16386c1209 --- /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 0000000000..2910d47b14 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..04e250ecca --- /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 0000000000..ff291e10ee --- /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 0000000000..0610770c37 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_19.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..ce4e5b5d92 --- /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 0000000000..1b87cef0dd --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..89ca946e5c --- /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 0000000000..c358e0c9b0 --- /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 0000000000..b8e0ca6c93 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_2.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..90c23c58fb --- /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 0000000000..e3b1d27829 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..da18246571 --- /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 0000000000..07771f1b95 --- /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 0000000000..4c361b982a --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_20.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..c8b7bf4482 --- /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 0000000000..dfc7ab831f --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..8f407b58f0 --- /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 0000000000..fe1001591c --- /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 0000000000..7e67e78c6d --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_21.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..04545012af --- /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 0000000000..e52aaaed65 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..98318c6355 --- /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 0000000000..8e6cd9e153 --- /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 0000000000..a5f8eea985 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_22.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..675d331558 --- /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 0000000000..bcde1e71eb --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..4b516c1fa0 --- /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 0000000000..cf532f1a6b --- /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 0000000000..df24b9929e --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_3.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..bcd6bcf194 --- /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 0000000000..9e07fad929 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..5d6feb257c --- /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 0000000000..9c500ae5c8 --- /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 0000000000..3539768d01 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_4.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..1a19598bd2 --- /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 0000000000..7bbcb58e83 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..719c3b3093 --- /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 0000000000..5103700053 --- /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 0000000000..f7b8b3be4d --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_5.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..183406eb82 --- /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 0000000000..6028d58a4d --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..636ef29b65 --- /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 0000000000..0882adc06f --- /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 0000000000..dad62b2ddc --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_6.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..85e23b7d84 --- /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 0000000000..c333e7ca0b --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..00e15ccbed --- /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 0000000000..bad88d7345 --- /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 0000000000..3c14f107f5 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_7.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..8c650997e4 --- /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 0000000000..6cb9632dec --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..4a1449973a --- /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 0000000000..65778c2d08 --- /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 0000000000..1d7c757eeb --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_8.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..559526edc1 --- /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 0000000000..dcc4ffaa4f --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..af52652b04 --- /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 0000000000..d408af1636 --- /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 0000000000..04cdee9da4 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Floating_Floating_Vector_9.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..88a34b5232 --- /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 0000000000..59f383e401 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..8e2ee4bd48 --- /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 0000000000..dfa6a4c08b --- /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 0000000000..f6270efeb4 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Scalar_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..b5a717efdf --- /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 0000000000..1d634917ab --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..0d611b54c6 --- /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 0000000000..d3f5444b9e --- /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 0000000000..20d1b4f20a --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingIntingInting_Vector_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..abc2be9283 --- /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 0000000000..edc1279191 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..010c52de9a --- /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 0000000000..a4dfe37216 --- /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 0000000000..e8f9a6f25a --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..01ffe59424 --- /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 0000000000..754e187161 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..87c25bc361 --- /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 0000000000..ef189dfdc4 --- /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 0000000000..e95f3e1c1b --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Scalar_1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..a5a4c67c2f --- /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 0000000000..828a6990de --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..65dd5a5bf8 --- /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 0000000000..3c0d4d6d19 --- /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 0000000000..d8a6fa38a7 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..d2c2caa289 --- /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 0000000000..e947913ff2 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..2fb9e72838 --- /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 0000000000..17494ca98b --- /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 0000000000..1e40c2caf5 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_IntingInting_Vector_1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..0d9ddef7d1 --- /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 0000000000..c3f15fd329 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..abf3eaa2b0 --- /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 0000000000..eaa6b3cd59 --- /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 0000000000..53978b854b --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Scalar_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..76be129055 --- /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 0000000000..b60592f1da --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..4aa3771947 --- /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 0000000000..a042e61111 --- /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 0000000000..a16acf9fad --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Inting_Inting_Vector_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..6a2a9013ab --- /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 0000000000..74dcc1c8ac --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..0515ba0f12 --- /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 0000000000..e6d5394258 --- /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 0000000000..63921c0178 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Scalar_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..a4c872c302 --- /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 0000000000..7d57d997f3 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..d60e6610e4 --- /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 0000000000..14b4acd2d9 --- /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 0000000000..357c4ad7dd --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUintingUinting_Vector_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..bb8214b68e --- /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 0000000000..eec15685e1 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..c92f1a4744 --- /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 0000000000..0966e6c539 --- /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 0000000000..7338b41553 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..f8d02107b6 --- /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 0000000000..b3bd92fe33 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..29c2259b20 --- /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 0000000000..b1696c01a2 --- /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 0000000000..1d6243dea4 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Scalar_1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..2e552fe3c1 --- /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 0000000000..f95d6fc823 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..b5963f041b --- /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 0000000000..e3d86b0dbe --- /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 0000000000..c5e299cea8 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_0.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..e6805139d7 --- /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 0000000000..b0b6f9e141 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..785230dd24 --- /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 0000000000..8c8fed99cd --- /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 0000000000..fad0f0f808 --- /dev/null +++ b/test/unittest/reader/spirv/Samples_SpvParserTest_GlslStd450_Uinting_UintingUinting_Vector_1.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..5d86c55349 --- /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 0000000000..f4c5a08175 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..11ba12a7ef --- /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 0000000000..94f5f56788 --- /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 0000000000..0375390249 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..2258453892 --- /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 0000000000..bd1ae8913c --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_Dot.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +fn main_1() { + let x_1 : vec2 = vec2(50.0, 60.0); + let x_2 : vec2 = vec2(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 0000000000..a1a91be790 --- /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 0000000000..6a5fd68b19 --- /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 0000000000..71427b2cf1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Scalar.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..6eec256e67 --- /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 0000000000..19dadbfe96 --- /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 0000000000..43fa080576 --- /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 0000000000..fc465ffb8d --- /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 0000000000..b00d178ee9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..d4c98083b1 --- /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 0000000000..25e93f04bf --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_FMod_Vector.spvasm.expected.wgsl @@ -0,0 +1,9 @@ +fn main_1() { + let x_1 : vec2 = (vec2(50.0, 60.0) - (vec2(60.0, 50.0) * floor((vec2(50.0, 60.0) / vec2(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 0000000000..ea116bb276 --- /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 0000000000..679689f968 --- /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 0000000000..c454b67a8d --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..900987a8e2 --- /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 0000000000..d05a95415d --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesMatrix.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +fn main_1() { + let x_1 : mat2x2 = mat2x2(vec2(50.0, 60.0), vec2(60.0, 50.0)); + let x_2 : mat2x2 = mat2x2(vec2(60.0, 50.0), vec2(50.0, 60.0)); + let x_10 : mat2x2 = (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 0000000000..d20ed13f0f --- /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 0000000000..b51b74e786 --- /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 0000000000..5e2d89de67 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..b0279b1152 --- /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 0000000000..f4611f438e --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesScalar.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +fn main_1() { + let x_1 : mat2x2 = mat2x2(vec2(50.0, 60.0), vec2(60.0, 50.0)); + let x_2 : f32 = 50.0; + let x_10 : mat2x2 = (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 0000000000..ef0e49fd5f --- /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 0000000000..7f8ada7657 --- /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 0000000000..5c2941d387 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..a06a834de5 --- /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 0000000000..d66e9e4f8c --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_MatrixTimesVector.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +fn main_1() { + let x_1 : mat2x2 = mat2x2(vec2(50.0, 60.0), vec2(60.0, 50.0)); + let x_2 : vec2 = vec2(50.0, 60.0); + let x_10 : vec2 = (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 0000000000..07cff26cd9 --- /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 0000000000..b6eb7ecb59 --- /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 0000000000..7246ce82c9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..cc8d70bd11 --- /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 0000000000..37432daf52 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_OuterProduct.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +fn main_1() { + let x_1 : vec3 = (vec3(50.0, 60.0, 70.0) + vec3(50.0, 60.0, 70.0)); + let x_2 : vec2 = (vec2(60.0, 50.0) + vec2(50.0, 60.0)); + let x_3 : mat2x3 = mat2x3(vec3((x_2.x * x_1.x), (x_2.x * x_1.y), (x_2.x * x_1.z)), vec3((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 0000000000..d47f67819e --- /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 0000000000..d3c8c9f24a --- /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 0000000000..42147379ee --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Scalar_UnsignedResult.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type((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 0000000000..c6dee99b4c --- /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 0000000000..046334f876 --- /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((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 0000000000..26a841b4f2 --- /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 0000000000..c14254142e --- /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 0000000000..b313264d20 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SDiv_Vector_UnsignedResult.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type((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 0000000000..a03b2fe046 --- /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 0000000000..bee7f5740a --- /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 = bitcast>((vec2(30, 40) / vec2(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 0000000000..c1ba578deb --- /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 0000000000..78291bb9ad --- /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 0000000000..ba27adffd7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Scalar_UnsignedResult.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type((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 0000000000..84d2f53bdf --- /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 0000000000..0bbe6cad68 --- /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((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 0000000000..528287cba4 --- /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 0000000000..174eca0dd5 --- /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 0000000000..88a291541b --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_SMod_Vector_UnsignedResult.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type((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 0000000000..f22b845b5b --- /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 0000000000..23f1bd0d84 --- /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 = bitcast>((vec2(30, 40) % vec2(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 0000000000..45ce944fd9 --- /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 0000000000..7f8ada7657 --- /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 0000000000..5c2941d387 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..a06a834de5 --- /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 0000000000..d66e9e4f8c --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesMatrix.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +fn main_1() { + let x_1 : mat2x2 = mat2x2(vec2(50.0, 60.0), vec2(60.0, 50.0)); + let x_2 : vec2 = vec2(50.0, 60.0); + let x_10 : vec2 = (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 0000000000..5d76916f67 --- /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 0000000000..1843297d99 --- /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 0000000000..c420ea44dd --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..64946edbe2 --- /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 0000000000..ac34d3c373 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryArithTestBasic_VectorTimesScalar.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +fn main_1() { + let x_1 : vec2 = vec2(50.0, 60.0); + let x_2 : f32 = 50.0; + let x_10 : vec2 = (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 0000000000..cf7cd345a7 --- /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 0000000000..1d554c3eab --- /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 0000000000..2072656a1b --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_0.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..9bcc44fa50 --- /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 0000000000..82db1f9564 --- /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 0000000000..ff5104289a --- /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 0000000000..1e5872e04d --- /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 0000000000..0a0efd23b6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_1.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..ed86b26361 --- /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 0000000000..36704aa104 --- /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 = vec2(50.0, 60.0); + let x_2 : vec2 = 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 0000000000..67692fbc33 --- /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 0000000000..94048485ba --- /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 0000000000..0a0efd23b6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_10.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..ed18e8b00c --- /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 0000000000..d7dacf3137 --- /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 = vec2(50.0, 60.0); + let x_2 : vec2 = 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 0000000000..2950eb352a --- /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 0000000000..2f2f39a0a6 --- /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 0000000000..d0b0b5497c --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_11.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..8d9e49ca8f --- /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 0000000000..ea448bc5bf --- /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 = vec3(50.0, 60.0, 70.0); + let x_2 : vec3 = 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 0000000000..29aae1417f --- /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 0000000000..a82b871219 --- /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 0000000000..3eb6aafbcb --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_12.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..0f6f954a7e --- /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 0000000000..fe17388315 --- /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 0000000000..267511367e --- /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 0000000000..978f994bf7 --- /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 0000000000..125c08e15c --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_13.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..dcf9a4028d --- /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 0000000000..1d303f3bf7 --- /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 = vec2(50.0, 60.0); + let x_2 : vec2 = 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 0000000000..0cd36e9ad5 --- /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 0000000000..14fdbca760 --- /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 0000000000..999f205bc8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_14.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..7f14b55623 --- /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 0000000000..0afb23d7e7 --- /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 = vec3(50.0, 60.0, 70.0); + let x_2 : vec3 = 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 0000000000..b919f68d93 --- /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 0000000000..f015927a8d --- /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 0000000000..948f0c9956 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_15.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..698703c973 --- /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 0000000000..bbea772640 --- /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 0000000000..e2934ee1b8 --- /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 0000000000..a945113ceb --- /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 0000000000..ee87b313bb --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_16.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..713c1131ed --- /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 0000000000..f67a29a335 --- /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 = vec2(50.0, 60.0); + let x_2 : vec2 = 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 0000000000..dcc45e4b60 --- /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 0000000000..ff6dce6fd5 --- /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 0000000000..8209a1dd6c --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_17.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..8252c42317 --- /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 0000000000..68b3fbf822 --- /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 = vec3(50.0, 60.0, 70.0); + let x_2 : vec3 = 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 0000000000..8b525db248 --- /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 0000000000..24551be955 --- /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 0000000000..2072656a1b --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_18.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..31a916fc51 --- /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 0000000000..0d94747ad3 --- /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 0000000000..6b6430cf03 --- /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 0000000000..00bec1c891 --- /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 0000000000..0a0efd23b6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_19.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..ab012a71bb --- /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 0000000000..acc24bd31d --- /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 = vec2(50.0, 60.0); + let x_2 : vec2 = 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 0000000000..7a15e91502 --- /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 0000000000..f9d2045b52 --- /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 0000000000..d0b0b5497c --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_2.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..b1749a2672 --- /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 0000000000..398fb2f030 --- /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 = vec3(50.0, 60.0, 70.0); + let x_2 : vec3 = 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 0000000000..81b894e6c2 --- /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 0000000000..9588372c0b --- /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 0000000000..d0b0b5497c --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_20.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..3593979b05 --- /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 0000000000..9b568c05f5 --- /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 = vec3(50.0, 60.0, 70.0); + let x_2 : vec3 = 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 0000000000..eeb9324f57 --- /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 0000000000..f79885f91c --- /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 0000000000..3eb6aafbcb --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_21.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..55befd088b --- /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 0000000000..fbdafc5c55 --- /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 0000000000..38ecedf504 --- /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 0000000000..b37528589a --- /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 0000000000..125c08e15c --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_22.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..93e296684f --- /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 0000000000..91825b5975 --- /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 = vec2(50.0, 60.0); + let x_2 : vec2 = 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 0000000000..19bf2427a3 --- /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 0000000000..99d51c191a --- /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 0000000000..999f205bc8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_23.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..35bc166e30 --- /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 0000000000..0d04201ef7 --- /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 = vec3(50.0, 60.0, 70.0); + let x_2 : vec3 = 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 0000000000..920f6cd687 --- /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 0000000000..f015927a8d --- /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 0000000000..948f0c9956 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_24.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..e0e37032e1 --- /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 0000000000..d2dba47139 --- /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 0000000000..846a47f170 --- /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 0000000000..a945113ceb --- /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 0000000000..ee87b313bb --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_25.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..ad91ad8034 --- /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 0000000000..5ddce508ab --- /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 = vec2(50.0, 60.0); + let x_2 : vec2 = 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 0000000000..d14afc2b76 --- /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 0000000000..ff6dce6fd5 --- /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 0000000000..8209a1dd6c --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_26.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..973575b706 --- /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 0000000000..d628e0f747 --- /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 = vec3(50.0, 60.0, 70.0); + let x_2 : vec3 = 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 0000000000..72492d04d1 --- /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 0000000000..ba90055f75 --- /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 0000000000..3eb6aafbcb --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_3.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..18dc2efc45 --- /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 0000000000..d83de4f4a7 --- /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 0000000000..471cfec405 --- /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 0000000000..63fe558852 --- /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 0000000000..125c08e15c --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_4.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..3c40cc6ef2 --- /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 0000000000..7e84a6a359 --- /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 = vec2(50.0, 60.0); + let x_2 : vec2 = 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 0000000000..bdbd489050 --- /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 0000000000..2597a98883 --- /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 0000000000..999f205bc8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_5.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..e9e4d0862e --- /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 0000000000..52878edde1 --- /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 = vec3(50.0, 60.0, 70.0); + let x_2 : vec3 = 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 0000000000..da62431a64 --- /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 0000000000..f015927a8d --- /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 0000000000..948f0c9956 --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_6.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..c71a50a67d --- /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 0000000000..f3acf8c20b --- /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 0000000000..69a4fec95c --- /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 0000000000..a945113ceb --- /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 0000000000..ee87b313bb --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_7.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..3f4bc91f9a --- /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 0000000000..a16d4d56a3 --- /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 = vec2(50.0, 60.0); + let x_2 : vec2 = 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 0000000000..485f363622 --- /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 0000000000..ff6dce6fd5 --- /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 0000000000..8209a1dd6c --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_8.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..f12d23590f --- /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 0000000000..bd2752b102 --- /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 = vec3(50.0, 60.0, 70.0); + let x_2 : vec3 = 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 0000000000..95b8e4d9a7 --- /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 0000000000..c1aadba57d --- /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 0000000000..2072656a1b --- /dev/null +++ b/test/unittest/reader/spirv/SpvBinaryDerivativeTest_SpvBinaryDerivativeTest_Derivatives_9.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..d7754fe205 --- /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 0000000000..c61e2ffa2d --- /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 0000000000..c86c7be923 --- /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 0000000000..d4ed465893 --- /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 0000000000..d7cb0c0060 --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Scalar.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..27280365b9 --- /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 0000000000..7e6f985597 --- /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 0000000000..165eea15e0 --- /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 0000000000..6e2c9c9f68 --- /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 0000000000..55eb273d1a --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..6865ccc435 --- /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 0000000000..91630e535e --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordEqual_Vector.spvasm.expected.wgsl @@ -0,0 +1,9 @@ +fn main_1() { + let x_1 : vec2 = !((vec2(50.0, 60.0) != vec2(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 0000000000..d400549332 --- /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 0000000000..6b5a3c6144 --- /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 0000000000..9c519dc814 --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Scalar.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..4c6f483a9e --- /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 0000000000..c9006fa333 --- /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 0000000000..6b180246dd --- /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 0000000000..e911ebf02c --- /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 0000000000..e9ababc038 --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..c9427b7b0c --- /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 0000000000..d92afa3f3c --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThanEqual_Vector.spvasm.expected.wgsl @@ -0,0 +1,9 @@ +fn main_1() { + let x_1 : vec2 = !((vec2(50.0, 60.0) < vec2(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 0000000000..ab755f02b3 --- /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 0000000000..c8232c5e11 --- /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 0000000000..1c146e7982 --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Scalar.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..5dbe6fe441 --- /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 0000000000..bfb44bdc4b --- /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 0000000000..d861844243 --- /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 0000000000..990f329f51 --- /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 0000000000..5e7ab76243 --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..bd947be77a --- /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 0000000000..c20efcd86c --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordGreaterThan_Vector.spvasm.expected.wgsl @@ -0,0 +1,9 @@ +fn main_1() { + let x_1 : vec2 = !((vec2(50.0, 60.0) <= vec2(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 0000000000..452ccf46d3 --- /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 0000000000..448c8b3e54 --- /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 0000000000..211c9b008a --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Scalar.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..0b46ad422e --- /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 0000000000..f0e117f806 --- /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 0000000000..905e9586c5 --- /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 0000000000..d9a0e67ad3 --- /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 0000000000..449f8f663e --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..9da8af0cbf --- /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 0000000000..a78ec59298 --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThanEqual_Vector.spvasm.expected.wgsl @@ -0,0 +1,9 @@ +fn main_1() { + let x_1 : vec2 = !((vec2(50.0, 60.0) > vec2(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 0000000000..777d2477cc --- /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 0000000000..68ba23daa3 --- /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 0000000000..c1f9ec60c4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Scalar.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..ce97680eb8 --- /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 0000000000..288eb16ec2 --- /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 0000000000..3e9064e5c8 --- /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 0000000000..c75e8f186f --- /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 0000000000..d1df2a8843 --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..88b76a458f --- /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 0000000000..54563a64b6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordLessThan_Vector.spvasm.expected.wgsl @@ -0,0 +1,9 @@ +fn main_1() { + let x_1 : vec2 = !((vec2(50.0, 60.0) >= vec2(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 0000000000..57d6df7898 --- /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 0000000000..4e0d011fc2 --- /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 0000000000..0c11121373 --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Scalar.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..1914d11146 --- /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 0000000000..26e0da0812 --- /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 0000000000..0848332744 --- /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 0000000000..6babf2498d --- /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 0000000000..2a6bb86252 --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..803c87deb6 --- /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 0000000000..c6e1a260e6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvFUnordTest_FUnordNotEqual_Vector.spvasm.expected.wgsl @@ -0,0 +1,9 @@ +fn main_1() { + let x_1 : vec2 = !((vec2(50.0, 60.0) == vec2(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 0000000000..ad88622608 --- /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 0000000000..7baa0d3733 --- /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 0000000000..6471daa3ff --- /dev/null +++ b/test/unittest/reader/spirv/SpvLogicalTest_All.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..4f0ec933ed --- /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 0000000000..13754e9666 --- /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(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 0000000000..fb37319b02 --- /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 0000000000..355566fcab --- /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 0000000000..2a1ff4f94c --- /dev/null +++ b/test/unittest/reader/spirv/SpvLogicalTest_Any.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..04cdf1c76b --- /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 0000000000..c83767f5ff --- /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(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 0000000000..ba1e0cc321 --- /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 0000000000..7b8907a0d0 --- /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 0000000000..3573991717 --- /dev/null +++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Scalar.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..6c8a8fdc07 --- /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 0000000000..b94365311a --- /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 0000000000..0c5217e499 --- /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 0000000000..15bb43ce65 --- /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 0000000000..4af81bfa7e --- /dev/null +++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..04fe7796c3 --- /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 0000000000..facbd2c2c9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvLogicalTest_IsInf_Vector.spvasm.expected.wgsl @@ -0,0 +1,9 @@ +fn main_1() { + let x_1 : vec2 = isInf(vec2(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 0000000000..9e4cc5e90b --- /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 0000000000..85fcf7b8c4 --- /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 0000000000..0d31ca91be --- /dev/null +++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Scalar.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..c4dd240a3e --- /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 0000000000..fc8c045c75 --- /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 0000000000..7b21f37878 --- /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 0000000000..06437ef9c0 --- /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 0000000000..a604594be7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..76fde6584e --- /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 0000000000..1542d4bdd5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvLogicalTest_IsNan_Vector.spvasm.expected.wgsl @@ -0,0 +1,9 @@ +fn main_1() { + let x_1 : vec2 = isNan(vec2(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 0000000000..59b9a4fae7 --- /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 0000000000..4cd29ebddb --- /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 0000000000..e9d89bb5e2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_BoolParams.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..e4b1526610 --- /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 0000000000..97b860cd0f --- /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 0000000000..e60ca87166 --- /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 0000000000..44e674756d --- /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 0000000000..23579065c2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_FloatScalarParams.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..5a1f1a2797 --- /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 0000000000..72689b530b --- /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 0000000000..74fd2ea197 --- /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 0000000000..30c0b9993a --- /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 0000000000..7ca3b5a882 --- /dev/null +++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_BoolCond_IntScalarParams.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..49265a3bb7 --- /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 0000000000..fcbb222e7a --- /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 0000000000..a7a3b62b85 --- /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 0000000000..4c97d412a6 --- /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 0000000000..385c9c35a5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvLogicalTest_Select_VecBoolCond_VectorParams.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..dcf2cf747e --- /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 0000000000..f7b7d94620 --- /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 = select(vec2(20u, 10u), vec2(10u, 20u), vec2(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 0000000000..cbc1de08ba --- /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 0000000000..5d2e80beff --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..ce68cdf817 --- /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 0000000000..dc4d09def4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_AnonWorkgroupVar.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..502a434ee7 --- /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 0000000000..cb7c87e644 --- /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 0000000000..41186135f4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..e9636c0cca --- /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 0000000000..9486c7d298 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayInitializer.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var x_200 : array = array(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 0000000000..65efcda69c --- /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 0000000000..0ef58fb09a --- /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 0000000000..41186135f4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..b237838438 --- /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 0000000000..83d177a52d --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ArrayNullInitializer.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var x_200 : array = array(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 0000000000..62a885ade6 --- /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 0000000000..adebfd696b --- /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 0000000000..fd04641ab0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..3f2fdf9d9f --- /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 0000000000..7bf378e926 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BindingDecoration_Valid.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +type Arr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : u32; + field1 : f32; + field2 : Arr; +}; + +[[group(0), binding(3)]] var 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 0000000000..1e234742db --- /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 0000000000..50204afd93 --- /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 0000000000..97f6e9e6e5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..8ad0a082be --- /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 0000000000..7cca8de7f8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_ReadReplaced_Vertex.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var x_2 : vec4; + +var x_900 : f32; + +fn main_1() { + x_900 = 1.0; + return; +} + +struct main_out { + [[builtin(position)]] + x_2_1 : vec4; +}; + +[[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 0000000000..af26af8f11 --- /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 0000000000..1993bce8dc --- /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 0000000000..31d71451d7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..8c45878c99 --- /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 0000000000..7f989e8d8e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_Write1_IsErased.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var x_2 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + x_2_1 : vec4; +}; + +[[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 0000000000..66cf753f24 --- /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 0000000000..1993bce8dc --- /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 0000000000..31d71451d7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..8c45878c99 --- /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 0000000000..7f989e8d8e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var x_2 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + x_2_1 : vec4; +}; + +[[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 0000000000..8bca660aef --- /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 0000000000..1993bce8dc --- /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 0000000000..31d71451d7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..8c45878c99 --- /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 0000000000..7f989e8d8e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Loose_WriteViaCopyObjectPriorAccess_Erased.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var x_2 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + x_2_1 : vec4; +}; + +[[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 0000000000..71c0143050 --- /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 0000000000..87eb6562fc --- /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 0000000000..12f6b15733 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..7bed4b7ca1 --- /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 0000000000..55cfd3482d --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_ReadReplaced.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var x_900 : f32; + +var gl_Position : vec4; + +fn main_1() { + x_900 = 1.0; + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[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 0000000000..abff3dbed5 --- /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 0000000000..b773910ceb --- /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 0000000000..8e83d1d3e8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..26910ee942 --- /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 0000000000..b9c43ff043 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var gl_Position : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[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 0000000000..38405c5f49 --- /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 0000000000..b773910ceb --- /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 0000000000..8e83d1d3e8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..26910ee942 --- /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 0000000000..b9c43ff043 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var gl_Position : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[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 0000000000..5b3b6650ac --- /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 0000000000..b773910ceb --- /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 0000000000..8e83d1d3e8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..26910ee942 --- /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 0000000000..b9c43ff043 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var gl_Position : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[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 0000000000..af425d1838 --- /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 0000000000..ca9f0146ea --- /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 0000000000..09a24c31df --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..dfb0c5df5e --- /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 0000000000..ed9859a7d0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var gl_Position : vec4 = vec4(1.0, 2.0, 3.0, 4.0); + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[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 0000000000..6ef0c06fb9 --- /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 0000000000..05826f0dd1 --- /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 0000000000..cbba9403c3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..e96f80d8e3 --- /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 0000000000..45b705fab8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var gl_Position : vec4; + +fn main_1() { + gl_Position = vec4(0.0, 0.0, 0.0, 0.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[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 0000000000..762230533d --- /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 0000000000..6ce5943ffa --- /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 0000000000..cd58c786b8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..358928585d --- /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 0000000000..45d50df8f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var gl_Position : vec4; + +fn main_1() { + gl_Position.y = 0.0; + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[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 0000000000..65b6be07c0 --- /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 0000000000..6ce5943ffa --- /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 0000000000..cd58c786b8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..358928585d --- /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 0000000000..45d50df8f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var gl_Position : vec4; + +fn main_1() { + gl_Position.y = 0.0; + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[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 0000000000..c1bffe56b9 --- /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 0000000000..05826f0dd1 --- /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 0000000000..cbba9403c3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..e96f80d8e3 --- /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 0000000000..45b705fab8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var gl_Position : vec4; + +fn main_1() { + gl_Position = vec4(0.0, 0.0, 0.0, 0.0); + return; +} + +struct main_out { + [[builtin(position)]] + gl_Position : vec4; +}; + +[[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 0000000000..582eeb3082 --- /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 0000000000..1e520e88b6 --- /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 0000000000..bb4bf26bdd --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..2cacf7fc89 --- /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 0000000000..1c1e5b8635 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var x_2 : u32; + +var position : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + position_1 : vec4; +}; + +[[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 0000000000..2867363851 --- /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 0000000000..ff4c73d6f7 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..54f15f97f0 --- /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 0000000000..6526967448 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_OppositeSignednessAsWGSL.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..f13e790258 --- /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 0000000000..415c810365 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..de8721667b --- /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 0000000000..21b73b396a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Input_SameSignednessAsWGSL.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..3d574a44fa --- /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 0000000000..542b23f46b --- /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 0000000000..2dea471f23 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..eb3e1f2efc --- /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 0000000000..005f56f6a1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_OppositeSignednessAsWGSL.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var x_1 : array = array(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 0000000000..b5b0d32458 --- /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 0000000000..f8d7e81087 --- /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 0000000000..1a7edffff4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..cb40bb04f4 --- /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 0000000000..1e6a354a10 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Builtin_Output_Initializer_SameSignednessAsWGSL.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var x_1 : array = array(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 0000000000..e43402cb1d --- /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 0000000000..ef0855d437 --- /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 0000000000..ecdf927bf2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..64446e5b5a --- /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 0000000000..79b8f4855c --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ColMajorDecoration_Dropped.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +[[block]] +struct S { + field0 : mat3x2; +}; + +[[group(0), binding(0)]] var 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 0000000000..62120a6c2f --- /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 0000000000..734ada384e --- /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 0000000000..fd04641ab0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..2abc2d9809 --- /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 0000000000..c732065a72 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_DescriptorGroupDecoration_Valid.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +type Arr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : u32; + field1 : f32; + field2 : Arr; +}; + +[[group(3), binding(9)]] var 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 0000000000..3e321c515c --- /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 0000000000..592cc4095f --- /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 0000000000..4792818531 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..9823b0dbab --- /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 0000000000..b1cced510a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_FragDepth_Out_Initializer.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..f52b885fcb --- /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 0000000000..5aaa5ee140 --- /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 0000000000..c87d85b6cb --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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(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 0000000000..7d9858e2b5 --- /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 0000000000..4d89296d13 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_OppositeSignedness.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var x_4 : i32; + +var x_1 : vec4; + +fn main_1() { + let x_2 : i32 = x_4; + return; +} + +struct main_out { + [[builtin(position)]] + x_1_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[builtin(instance_index)]] x_4_param : u32) -> main_out { + x_4 = bitcast(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 0000000000..4d554aa54a --- /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 0000000000..0d3adff852 --- /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 0000000000..3a92aaa9d5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..841fa48f16 --- /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 0000000000..0258417d7a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_Input_SameSignedness.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var x_1 : u32; + +var x_4 : vec4; + +fn main_1() { + let x_2 : u32 = x_1; + return; +} + +struct main_out { + [[builtin(position)]] + x_4_1 : vec4; +}; + +[[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 0000000000..ebd915b3a0 --- /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 0000000000..1956d46611 --- /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 0000000000..17039f4398 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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(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 0000000000..c9214675b2 --- /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 0000000000..a4ecdbb41a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Signed.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +var x_1 : array; + +fn main_1() { + return; +} + +[[stage(fragment)]] +fn main([[builtin(sample_mask)]] x_1_param : u32) { + x_1[0] = bitcast(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 0000000000..d8324dc99f --- /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 0000000000..ae1dd89d79 --- /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 0000000000..03c6bea066 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..0b52389ed8 --- /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 0000000000..9850594c7a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_In_Unsigned.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +var x_1 : array; + +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 0000000000..4c761ec196 --- /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 0000000000..19fa549491 --- /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 0000000000..2073b562f7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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(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 0000000000..a8e50ce80f --- /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 0000000000..48a29f644f --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Signed_Initializer.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var x_1 : array = array(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(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 0000000000..a1a5af6e99 --- /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 0000000000..db4a8bcbb4 --- /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 0000000000..a09d091b4c --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..d95cd17fb4 --- /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 0000000000..1011156286 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_BuiltinVar_SampleMask_Out_Unsigned_Initializer.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var x_1 : array = array(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 0000000000..adc2370839 --- /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 0000000000..8aa1229742 --- /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 0000000000..ce7d66dd16 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Flat_Fragment_In.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +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 0000000000..8b480f53c9 --- /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 0000000000..490af9f3d6 --- /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 x_1 : array; + +var 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 0000000000..cc6fcfd89c --- /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 0000000000..acb71cc17b --- /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 0000000000..be0799e326 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_In.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +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 0000000000..9a2338777a --- /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 0000000000..6f69d2fd35 --- /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 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 0000000000..cddeeec75c --- /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 0000000000..dfc897afa9 --- /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 0000000000..6f664e8257 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Flatten_Interpolation_Floating_Fragment_Out.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +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 0000000000..d6f39905bf --- /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 0000000000..985d7db42f --- /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 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 0000000000..55e55eebb4 --- /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 0000000000..9442b68862 --- /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 0000000000..79eaec29b1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..07d96dd40c --- /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 0000000000..542ae52e13 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_IOLocations.spvasm.expected.wgsl @@ -0,0 +1,26 @@ +var x_1 : u32; + +var x_2 : u32; + +var x_3 : u32; + +var 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 0000000000..5e28c67cf5 --- /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 0000000000..663d6d000a --- /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 0000000000..8ddfb0777a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.msl @@ -0,0 +1,48 @@ +#include + +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 0000000000..9ee3142786 --- /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 0000000000..7122217b26 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_In.spvasm.expected.wgsl @@ -0,0 +1,34 @@ +var x_1 : u32; + +var x_2 : vec2; + +var x_3 : i32; + +var x_4 : vec2; + +var x_5 : f32; + +var x_6 : vec2; + +var x_8 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + x_8_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[location(1)]] x_1_param : u32, [[location(2)]] x_2_param : vec2, [[location(3)]] x_3_param : i32, [[location(4)]] x_4_param : vec2, [[location(5), interpolate(flat)]] x_5_param : f32, [[location(6), interpolate(flat)]] x_6_param : vec2) -> 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 0000000000..5cecd41c48 --- /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 0000000000..453432ded3 --- /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 0000000000..05b18ed806 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +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 0000000000..52337ff8ef --- /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 0000000000..06f66acb84 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Flat_Vertex_Output.spvasm.expected.wgsl @@ -0,0 +1,40 @@ +var x_1 : u32; + +var x_2 : vec2; + +var x_3 : i32; + +var x_4 : vec2; + +var x_5 : f32; + +var x_6 : vec2; + +var x_8 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[location(1)]] + x_1_1 : u32; + [[location(2)]] + x_2_1 : vec2; + [[location(3)]] + x_3_1 : i32; + [[location(4)]] + x_4_1 : vec2; + [[location(5), interpolate(flat)]] + x_5_1 : f32; + [[location(6), interpolate(flat)]] + x_6_1 : vec2; + [[builtin(position)]] + x_8_1 : vec4; +}; + +[[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 0000000000..cd749572ec --- /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 0000000000..0c3175afd0 --- /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 0000000000..783515b256 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +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 0000000000..a5b6742137 --- /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 0000000000..aad522832e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_In.spvasm.expected.wgsl @@ -0,0 +1,26 @@ +var x_1 : f32; + +var x_2 : f32; + +var x_3 : f32; + +var x_4 : f32; + +var x_5 : f32; + +var 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 0000000000..ea0075ea27 --- /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 0000000000..2832006fc1 --- /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 0000000000..f4302dcd6d --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.msl @@ -0,0 +1,37 @@ +#include + +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 0000000000..ce9d79a56e --- /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 0000000000..32293356c1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_EntryPointWrapping_Interpolation_Floating_Fragment_Out.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +var x_1 : f32; + +var x_2 : f32; + +var x_3 : f32; + +var x_4 : f32; + +var x_5 : f32; + +var 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 0000000000..e74d30e857 --- /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 0000000000..0903e46fd6 --- /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 0000000000..bbe3dc42f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +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 0000000000..1fb50f346d --- /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 0000000000..67fb38002c --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_FlattenStruct_LocOnMembers.spvasm.expected.wgsl @@ -0,0 +1,31 @@ +struct Communicators { + alice : f32; + bob : vec4; +}; + +var x_1 : Communicators; + +var x_3 : Communicators; + +var x_2 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + x_2_1 : vec4; + [[location(9)]] + x_3_1 : f32; + [[location(11)]] + x_3_2 : vec4; +}; + +[[stage(vertex)]] +fn main([[location(9)]] x_1_param : f32, [[location(11)]] x_1_param_1 : vec4) -> 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 0000000000..0a681c9248 --- /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 0000000000..415c810365 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..de8721667b --- /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 0000000000..21b73b396a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InputVarsConvertedToPrivate.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..864e0ac649 --- /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 0000000000..0d79f1af4f --- /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 0000000000..8afc07aba4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.msl @@ -0,0 +1,37 @@ +#include + +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 0000000000..280aeff65d --- /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 0000000000..70c14aab43 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenArray_OneLevel.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var x_1 : array; + +var x_2 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + x_2_1 : vec4; +}; + +[[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 0000000000..e893356e4b --- /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 0000000000..3165ed2654 --- /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 0000000000..b65de1597f --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +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 0000000000..34cb4edb9f --- /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 0000000000..d10109702c --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenMatrix.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var x_1 : mat2x4; + +var x_2 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + x_2_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[location(9)]] x_1_param : vec4, [[location(10)]] x_1_param_1 : vec4) -> 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 0000000000..15c3f9b619 --- /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 0000000000..14b0548d8c --- /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 0000000000..059776b0a6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +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 0000000000..b6bb3a766e --- /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 0000000000..d6d08ca1db --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenNested.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var x_1 : array, 2>; + +var x_2 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + x_2_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[location(7)]] x_1_param : vec4, [[location(8)]] x_1_param_1 : vec4, [[location(9)]] x_1_param_2 : vec4, [[location(10)]] x_1_param_3 : vec4) -> 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 0000000000..e780dfa6e8 --- /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 0000000000..f8df6da46a --- /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 0000000000..d95c9b2426 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..4c6f2ca291 --- /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 0000000000..01cb741119 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Input_FlattenStruct_LocOnVariable.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +struct Communicators { + alice : f32; + bob : vec4; +}; + +var x_1 : Communicators; + +var x_2 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + x_2_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[location(9)]] x_1_param : f32, [[location(10)]] x_1_param_1 : vec4) -> 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 0000000000..7f8daeeb12 --- /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 0000000000..b7ca2fa83a --- /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 0000000000..523de1081a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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(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 0000000000..d90a2cd538 --- /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 0000000000..53c874399e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_AccessChain.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var x_4 : i32; + +var position : vec4; + +fn main_1() { + let x_2 : i32 = x_4; + return; +} + +struct main_out { + [[builtin(position)]] + position_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[builtin(instance_index)]] x_4_param : u32) -> main_out { + x_4 = bitcast(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 0000000000..493046c51e --- /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 0000000000..b7ca2fa83a --- /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 0000000000..523de1081a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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(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 0000000000..d90a2cd538 --- /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 0000000000..cfcf7b36c6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_CopyObject.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var x_4 : i32; + +var position : vec4; + +fn main_1() { + let x_14 : ptr = &(x_4); + let x_2 : i32 = *(x_14); + return; +} + +struct main_out { + [[builtin(position)]] + position_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[builtin(instance_index)]] x_4_param : u32) -> main_out { + x_4 = bitcast(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 0000000000..c01aa85042 --- /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 0000000000..b7ca2fa83a --- /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 0000000000..523de1081a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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(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 0000000000..d90a2cd538 --- /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 0000000000..53c874399e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_I32_Load_Direct.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var x_4 : i32; + +var position : vec4; + +fn main_1() { + let x_2 : i32 = x_4; + return; +} + +struct main_out { + [[builtin(position)]] + position_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[builtin(instance_index)]] x_4_param : u32) -> main_out { + x_4 = bitcast(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 0000000000..ada0d60559 --- /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 0000000000..5f44758dc5 --- /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 0000000000..ec253ecf88 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..123e58bf3d --- /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 0000000000..213cedff39 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_AccessChain.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var x_4 : u32; + +var position : vec4; + +fn main_1() { + let x_2 : u32 = x_4; + return; +} + +struct main_out { + [[builtin(position)]] + position_1 : vec4; +}; + +[[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 0000000000..12195cdcf3 --- /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 0000000000..5f44758dc5 --- /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 0000000000..ec253ecf88 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..123e58bf3d --- /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 0000000000..4318882911 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_CopyObject.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var x_4 : u32; + +var position : vec4; + +fn main_1() { + let x_14 : ptr = &(x_4); + let x_2 : u32 = *(x_14); + return; +} + +struct main_out { + [[builtin(position)]] + position_1 : vec4; +}; + +[[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 0000000000..873e6ff519 --- /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 0000000000..5f44758dc5 --- /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 0000000000..ec253ecf88 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..123e58bf3d --- /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 0000000000..213cedff39 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_InstanceIndex_U32_Load_Direct.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var x_4 : u32; + +var position : vec4; + +fn main_1() { + let x_2 : u32 = x_4; + return; +} + +struct main_out { + [[builtin(position)]] + position_1 : vec4; +}; + +[[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 0000000000..2d749c1187 --- /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 0000000000..9b65d1f78d --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..34d28dfc8e --- /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 0000000000..1d137c937c --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixInitializer.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var x_200 : mat3x2 = mat3x2(vec2(1.5, 2.0), vec2(2.0, 3.0), vec2(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 0000000000..0f458569db --- /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 0000000000..89e1fde979 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..afc1b9fcff --- /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 0000000000..bc1e84bff3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixNullInitializer.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var x_200 : mat3x2 = mat3x2(vec2(0.0, 0.0), vec2(0.0, 0.0), vec2(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 0000000000..ea9f6c5c51 --- /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 0000000000..ef0855d437 --- /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 0000000000..ecdf927bf2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..64446e5b5a --- /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 0000000000..79b8f4855c --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_MatrixStrideDecoration_Dropped.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +[[block]] +struct S { + field0 : mat3x2; +}; + +[[group(0), binding(0)]] var 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 0000000000..b4be368d13 --- /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 0000000000..2ce495ea89 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..20f308bc6b --- /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 0000000000..1ab5fb5d13 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NamedWorkgroupVar.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..57d2697f12 --- /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 0000000000..113536831c --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_NoVar.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..ca944f0cc9 --- /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 0000000000..471e2a6e06 --- /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 0000000000..f0d1d726f0 --- /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 0000000000..415c810365 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..de8721667b --- /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 0000000000..21b73b396a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..4aecc8999a --- /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 0000000000..d9b85b31e3 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..ced9f15f45 --- /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 0000000000..146796b639 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_OutputVarsConvertedToPrivate_WithInitializer.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..b50504d718 --- /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 0000000000..0d3cc17f2f --- /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 0000000000..c00c75ec1c --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.msl @@ -0,0 +1,32 @@ +#include + +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 0000000000..6ce7ccceac --- /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 0000000000..eafdb67f69 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenArray_OneLevel.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var x_1 : array; + +var x_2 : vec4; + +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; +}; + +[[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 0000000000..87a8dc96a6 --- /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 0000000000..41ab4a7491 --- /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 0000000000..794f327154 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +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 0000000000..4c93fecc34 --- /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 0000000000..4bd102de06 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenMatrix.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var x_1 : mat2x4; + +var x_2 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[location(9)]] + x_1_1 : vec4; + [[location(10)]] + x_1_2 : vec4; + [[builtin(position)]] + x_2_1 : vec4; +}; + +[[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 0000000000..6da3c09f36 --- /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 0000000000..2efd4a32e6 --- /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 0000000000..3ecb5dadea --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +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 0000000000..0d54b93e3a --- /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 0000000000..3283c5821e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_Output_FlattenStruct_LocOnVariable.spvasm.expected.wgsl @@ -0,0 +1,27 @@ +struct Communicators { + alice : f32; + bob : vec4; +}; + +var x_1 : Communicators; + +var x_2 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[location(9)]] + x_1_1 : f32; + [[location(10)]] + x_1_2 : vec4; + [[builtin(position)]] + x_2_1 : vec4; +}; + +[[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 0000000000..7f40308cc1 --- /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 0000000000..76182bd1af --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..458710e2dd --- /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 0000000000..46b790fa8d --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_PrivateVar.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..03b178d0d9 --- /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 0000000000..702cebb6a4 --- /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 0000000000..5abadcb75b --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..2cc5536e76 --- /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 0000000000..5035555741 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_AccessChain.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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(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 0000000000..8f5673217d --- /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 0000000000..702cebb6a4 --- /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 0000000000..5abadcb75b --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..2cc5536e76 --- /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 0000000000..cc8821efb2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_CopyObject.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var x_1 : i32; + +fn main_1() { + let x_11 : ptr = &(x_1); + let x_2 : i32 = *(x_11); + return; +} + +[[stage(fragment)]] +fn main([[builtin(sample_index)]] x_1_param : u32) { + x_1 = bitcast(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 0000000000..e723d72c8b --- /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 0000000000..702cebb6a4 --- /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 0000000000..5abadcb75b --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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(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 0000000000..2cc5536e76 --- /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 0000000000..5035555741 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_I32_Load_Direct.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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(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 0000000000..ccfb3d148b --- /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 0000000000..a7810ba3b7 --- /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 0000000000..68116a94c9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..82c6620edc --- /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 0000000000..9b4cf72bff --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_AccessChain.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..96f57aad67 --- /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 0000000000..a7810ba3b7 --- /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 0000000000..68116a94c9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..82c6620edc --- /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 0000000000..bbfa55eba9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_CopyObject.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var x_1 : u32; + +fn main_1() { + let x_11 : ptr = &(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 0000000000..df672992b5 --- /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 0000000000..a7810ba3b7 --- /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 0000000000..68116a94c9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..82c6620edc --- /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 0000000000..9b4cf72bff --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleId_U32_Load_Direct.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..de592f9612 --- /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 0000000000..69c22b5092 --- /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 0000000000..b408ffeacb --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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(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 0000000000..50e061129c --- /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 0000000000..8e340b13da --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_AccessChain.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : array; + +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(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 0000000000..432b5d9625 --- /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 0000000000..69c22b5092 --- /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 0000000000..b408ffeacb --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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(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 0000000000..50e061129c --- /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 0000000000..8e340b13da --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_CopyObject.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : array; + +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(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 0000000000..ecec88b517 --- /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 0000000000..8d551f5ee7 --- /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 0000000000..5ec09f0ad6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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(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 0000000000..50e061129c --- /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 0000000000..95ed8a7e61 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_I32_Direct.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : array; + +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(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 0000000000..ecbb7c91bf --- /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 0000000000..137131249d --- /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 0000000000..aebd0dd828 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..0fa19bde25 --- /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 0000000000..e5d5580072 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_AccessChain.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : array; + +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 0000000000..d0d60ec9f0 --- /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 0000000000..137131249d --- /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 0000000000..aebd0dd828 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..0fa19bde25 --- /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 0000000000..e5d5580072 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_CopyObject.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : array; + +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 0000000000..98f35f76d2 --- /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 0000000000..46546824db --- /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 0000000000..210b39c6fb --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..0fa19bde25 --- /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 0000000000..911c8ad397 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_U32_Direct.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var x_1 : array; + +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 0000000000..30d997f97e --- /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 0000000000..46546824db --- /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 0000000000..1c10d95fc5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.msl @@ -0,0 +1,28 @@ +#include + +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 0000000000..0fa19bde25 --- /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 0000000000..d0434bb881 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_In_WithStride.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +type Arr = [[stride(4)]] array; + +type Arr_1 = [[stride(4)]] array; + +type Arr_2 = [[stride(4)]] array; + +type Arr_3 = [[stride(4)]] array; + +var 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 0000000000..1cb5b10d6b --- /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 0000000000..65e2701f73 --- /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 0000000000..ba3a014b6a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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(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 0000000000..709f912404 --- /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 0000000000..42f076078a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_AccessChain.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var x_1 : array; + +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(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 0000000000..02285ca651 --- /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 0000000000..65e2701f73 --- /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 0000000000..ba3a014b6a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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(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 0000000000..709f912404 --- /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 0000000000..42f076078a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_CopyObject.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var x_1 : array; + +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(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 0000000000..f63600f970 --- /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 0000000000..65e2701f73 --- /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 0000000000..ba3a014b6a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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(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 0000000000..709f912404 --- /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 0000000000..42f076078a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_I32_Direct.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var x_1 : array; + +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(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 0000000000..28e9dc77f5 --- /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 0000000000..a6c36ef4c7 --- /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 0000000000..2c5517016e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..5fc4f5f51a --- /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 0000000000..8791e1cbbd --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_AccessChain.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var x_1 : array; + +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 0000000000..df3f5813d9 --- /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 0000000000..a6c36ef4c7 --- /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 0000000000..2c5517016e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..5fc4f5f51a --- /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 0000000000..8791e1cbbd --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_CopyObject.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var x_1 : array; + +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 0000000000..f62eda14c0 --- /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 0000000000..a6c36ef4c7 --- /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 0000000000..2c5517016e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..5fc4f5f51a --- /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 0000000000..8791e1cbbd --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_U32_Direct.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var x_1 : array; + +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 0000000000..5a6e396a3f --- /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 0000000000..a6c36ef4c7 --- /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 0000000000..5a94feea3a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..5fc4f5f51a --- /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 0000000000..fdce3e25c0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_SampleMask_Out_WithStride.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +type Arr = [[stride(4)]] array; + +type Arr_1 = [[stride(4)]] array; + +type Arr_2 = [[stride(4)]] array; + +type Arr_3 = [[stride(4)]] array; + +var 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 0000000000..326d5bb13a --- /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 0000000000..f31c4272a2 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..dc898feb64 --- /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 0000000000..22083e1cbb --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarInitializers.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var x_1 : bool = true; + +var x_2 : bool = false; + +var x_3 : i32 = -1; + +var x_4 : u32 = 1u; + +var 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 0000000000..c446686dd0 --- /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 0000000000..1488be819a --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..29592b70f3 --- /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 0000000000..aa25194c4a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarNullInitializers.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var x_1 : bool = false; + +var x_2 : i32 = 0; + +var x_3 : u32 = 0u; + +var 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 0000000000..44957625af --- /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 0000000000..566f3415a3 --- /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 0000000000..4677fca195 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..9972bb5eab --- /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 0000000000..db31ce6046 --- /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 0000000000..a4b993f657 --- /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 0000000000..381aa13b68 --- /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 0000000000..dcbce29e17 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_F32_WithoutSpecId.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..eda6c88a8b --- /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 0000000000..9821d8b1ae --- /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 0000000000..ae487d5d71 --- /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 0000000000..1f95b39f6d --- /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 0000000000..fe268c405e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_False.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..213d2fd3e4 --- /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 0000000000..58606bc61f --- /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 0000000000..c955a79a35 --- /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 0000000000..e2f518bd53 --- /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 0000000000..a23617b54a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_I32.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..de23b73de2 --- /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 0000000000..f6d39f8c0a --- /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 0000000000..c687c937f8 --- /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 0000000000..960b2a2a2d --- /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 0000000000..2d9ab1d588 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_Id_MaxValid.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..23b6d79407 --- /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 0000000000..cb4864eb5d --- /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 0000000000..1f56e04127 --- /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 0000000000..16032061c3 --- /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 0000000000..fe268c405e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_True.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..2770f9ec1f --- /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 0000000000..caa65dcff2 --- /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 0000000000..2ab2c756ba --- /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 0000000000..ba040ea134 --- /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 0000000000..19c2af7005 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_DeclareConst_U32.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..9461ab1dc8 --- /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 0000000000..86846edeec --- /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 0000000000..096d33f363 --- /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 0000000000..41fb01dfbc --- /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 0000000000..c8f2a48f6f --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_ScalarSpecConstant_UsedInFunction.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..8c812c0ba8 --- /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 0000000000..3c3108e952 --- /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 0000000000..7793290d8a --- /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 0000000000..006f2c1cf5 --- /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 0000000000..0766b35e18 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_AllMembers.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..a8f386b37c --- /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 0000000000..ff67ffa01d --- /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 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 0000000000..8c115855b1 --- /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 0000000000..356578f153 --- /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 0000000000..0766b35e18 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..7734cd7043 --- /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 0000000000..408912e778 --- /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 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 0000000000..c2b3547bbb --- /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 0000000000..356578f153 --- /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 0000000000..0766b35e18 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StorageBuffer_NonWritable_NotAllMembers_DuplicatedOnSameMember.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..7734cd7043 --- /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 0000000000..408912e778 --- /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 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 0000000000..e12f585bb3 --- /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 0000000000..8e7b09e088 --- /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 0000000000..967624c9d9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..450c52da06 --- /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 0000000000..ce1529bc43 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructInitializer.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +struct S { + field0 : u32; + field1 : f32; + field2 : array; +}; + +var x_200 : S = S(1u, 1.5, array(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 0000000000..8c3b06f549 --- /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 0000000000..356578f153 --- /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 0000000000..fd04641ab0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..538543061b --- /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 0000000000..7a1df2aedf --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructMember_NonReadableDecoration_Dropped.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +type Arr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : u32; + field1 : f32; + field2 : Arr; +}; + +[[group(0), binding(0)]] var 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 0000000000..eedbd48955 --- /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 0000000000..630bcc207b --- /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 0000000000..967624c9d9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..ede3bc6254 --- /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 0000000000..46c9e5251f --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_StructNullInitializer.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +struct S { + field0 : u32; + field1 : f32; + field2 : array; +}; + +var x_200 : S = S(0u, 0.0, array(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 0000000000..cfdd81d150 --- /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 0000000000..3bd690c506 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..2b85452394 --- /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 0000000000..7d0f3a43bc --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorBoolNullInitializer.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var x_200 : vec2 = vec2(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 0000000000..8324367e3d --- /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 0000000000..09fde37887 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..a9c49dd418 --- /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 0000000000..e4716f334e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorFloatNullInitializer.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var x_200 : vec2 = vec2(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 0000000000..6ae1424875 --- /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 0000000000..64afda1006 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..390aea8393 --- /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 0000000000..5317c3c27e --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorInitializer.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var x_200 : vec2 = vec2(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 0000000000..5f1dfd4c0c --- /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 0000000000..f241300526 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..73eb146d32 --- /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 0000000000..f6022185ef --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorIntNullInitializer.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var x_200 : vec2 = vec2(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 0000000000..712904c2d0 --- /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 0000000000..0fb91cc4c5 --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..3374b53404 --- /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 0000000000..c248ed3c72 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VectorUintNullInitializer.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var x_200 : vec2 = vec2(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 0000000000..2fdbed6ffd --- /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 0000000000..8f12356286 --- /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 0000000000..884397dca6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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(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 0000000000..6416131a90 --- /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 0000000000..43d88d38fa --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_AccessChain.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var x_4 : i32; + +var x_1 : vec4; + +fn main_1() { + let x_2 : i32 = x_4; + return; +} + +struct main_out { + [[builtin(position)]] + x_1_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[builtin(vertex_index)]] x_4_param : u32) -> main_out { + x_4 = bitcast(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 0000000000..b504091c0e --- /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 0000000000..8f12356286 --- /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 0000000000..884397dca6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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(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 0000000000..6416131a90 --- /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 0000000000..44937db477 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_CopyObject.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var x_4 : i32; + +var x_1 : vec4; + +fn main_1() { + let x_14 : ptr = &(x_4); + let x_2 : i32 = *(x_14); + return; +} + +struct main_out { + [[builtin(position)]] + x_1_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[builtin(vertex_index)]] x_4_param : u32) -> main_out { + x_4 = bitcast(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 0000000000..17bd36d878 --- /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 0000000000..8f12356286 --- /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 0000000000..884397dca6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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(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 0000000000..6416131a90 --- /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 0000000000..43d88d38fa --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_I32_Load_Direct.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var x_4 : i32; + +var x_1 : vec4; + +fn main_1() { + let x_2 : i32 = x_4; + return; +} + +struct main_out { + [[builtin(position)]] + x_1_1 : vec4; +}; + +[[stage(vertex)]] +fn main([[builtin(vertex_index)]] x_4_param : u32) -> main_out { + x_4 = bitcast(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 0000000000..0848db7ad9 --- /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 0000000000..918354f662 --- /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 0000000000..3c270f771d --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..7fb3bc7e93 --- /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 0000000000..ef5bf469ad --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_AccessChain.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var x_4 : u32; + +var x_1 : vec4; + +fn main_1() { + let x_2 : u32 = x_4; + return; +} + +struct main_out { + [[builtin(position)]] + x_1_1 : vec4; +}; + +[[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 0000000000..3aabec6325 --- /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 0000000000..918354f662 --- /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 0000000000..3c270f771d --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..7fb3bc7e93 --- /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 0000000000..cf6e07ae3a --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_CopyObject.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var x_4 : u32; + +var x_1 : vec4; + +fn main_1() { + let x_14 : ptr = &(x_4); + let x_2 : u32 = *(x_14); + return; +} + +struct main_out { + [[builtin(position)]] + x_1_1 : vec4; +}; + +[[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 0000000000..8af2129cd9 --- /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 0000000000..918354f662 --- /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 0000000000..3c270f771d --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..7fb3bc7e93 --- /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 0000000000..ef5bf469ad --- /dev/null +++ b/test/unittest/reader/spirv/SpvModuleScopeVarParserTest_VertexIndex_U32_Load_Direct.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var x_4 : u32; + +var x_1 : vec4; + +fn main_1() { + let x_2 : u32 = x_4; + return; +} + +struct main_out { + [[builtin(position)]] + x_1_1 : vec4; +}; + +[[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 0000000000..52f74d5b73 --- /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 0000000000..a6998acf3c --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..ecb3bc9529 --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsNotHeader.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..e2f70c1c01 --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_SingleBlockContinueConstruct.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..ba6d025624 --- /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 0000000000..a6998acf3c --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_BackEdge_SingleBlockLoop.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..bf5da38858 --- /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 0000000000..7abd8f9461 --- /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 0000000000..15a55362b1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..e591acfc24 --- /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 0000000000..6c1a4a493f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..e3f3d8ddaa --- /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 0000000000..bd88cfc437 --- /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 0000000000..5a8b82a7ee --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..98443a8bf3 --- /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 0000000000..0871e80088 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var 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 0000000000..5ab7265d27 --- /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 0000000000..bb3c3e0e3e --- /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 0000000000..bdb9c187a0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..2a1a8cacec --- /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 0000000000..c29337c4e1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var 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 0000000000..8d570b3b0f --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToElse.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..654a3f245d --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_IfToThen.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..7e9817252e --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_LoopHeadToBody.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..fa4b540223 --- /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 0000000000..b37d3379c2 --- /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 0000000000..9ea19ca1e5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..53e20063cf --- /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 0000000000..fe32b0fd7b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToCase.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..125457bb6b --- /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 0000000000..b37d3379c2 --- /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 0000000000..9ea19ca1e5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..53e20063cf --- /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 0000000000..fe32b0fd7b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Forward_SwitchToDefaultNotMerge.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..708ee6f545 --- /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 0000000000..430e5fb94a --- /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 0000000000..767c0279b0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..fe7743348a --- /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 0000000000..6fd58e431f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..21b8b870e2 --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfHeader.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..3cfda24a0f --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromIfThenElse.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..ca8b8530ac --- /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 0000000000..c15b476b7f --- /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 0000000000..34e24085e3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..7368bdaa51 --- /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 0000000000..7d8850badf --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..bb14141909 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructHeader.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..99f55320c3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructHeader.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..bb14141909 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructTail.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..99f55320c3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromContinueConstructTail.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..517ad6ca3d --- /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 0000000000..56dedb5b01 --- /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 0000000000..11d5e00de9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..21d52a4042 --- /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 0000000000..5b862df0ff --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBody.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var 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 0000000000..08b6c8fa27 --- /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 0000000000..7fbc796d87 --- /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 0000000000..baeb119c5b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..d7eea0c329 --- /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 0000000000..304252cb42 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyDirect.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var 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 0000000000..48e8bb06f7 --- /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 0000000000..9a2183e15c --- /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 0000000000..1f53e065da --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..ca2cb6b84e --- /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 0000000000..edd72adc78 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Conditional.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..3721240493 --- /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 0000000000..c38af3d8e7 --- /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 0000000000..8f73d74c72 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..f6d836451c --- /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 0000000000..ff57f2f52a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopBodyNestedSelection_Unconditional.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..6d72984837 --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_MultiBlockLoop.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..0ead87b79d --- /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 0000000000..a6998acf3c --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_FalseBranch.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..4d341899da --- /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 0000000000..9f08a4eea1 --- /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 0000000000..fc2a957ba6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..e406af24de --- /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 0000000000..d089493867 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..e4daf38cc5 --- /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 0000000000..71e94e899d --- /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 0000000000..e5c85e6817 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..6553da9fdf --- /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 0000000000..bb1bf7c573 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_ConditionalFromNestedIf.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..78e2ff5ca2 --- /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 0000000000..218e1b391e --- /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 0000000000..e83d11c916 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..0a750f4da4 --- /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 0000000000..dd4e39014b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedIf.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..3672e9a206 --- /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 0000000000..59c7c7ad99 --- /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 0000000000..96c7549fa3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +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 0000000000..db9c97e49d --- /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 0000000000..1373cbd5e6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchCaseBody_Unconditional.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..9164014d6d --- /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 0000000000..89ab524842 --- /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 0000000000..95ee233680 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..e3cc16221c --- /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 0000000000..6f6fe49cf4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Conditional.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var 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 0000000000..888bd4ef9b --- /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 0000000000..260d523b6c --- /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 0000000000..88b3e07ae2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +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 0000000000..baeafde334 --- /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 0000000000..a4191259e2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_FromNestedSwitchDefaultBody_Unconditional.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..abfa5521f0 --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopContinue_LoopBodyToContinue.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..a8ed3699ff --- /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 0000000000..57f0f07c2f --- /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 0000000000..f88292dcd0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..e19655c898 --- /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 0000000000..aacd780ebe --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_LoopHeadSplitBody.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var 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 0000000000..e83f62e1d1 --- /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 0000000000..6280e0e88c --- /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 0000000000..ec038a3f5c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..0979ee2395 --- /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 0000000000..4abd08ff58 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Premerge.spvasm.expected.wgsl @@ -0,0 +1,14 @@ +var 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 0000000000..641a00cf44 --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Pathological_Forward_Regardless.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..20eec07213 --- /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 0000000000..41886ebdd6 --- /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 0000000000..1a544d20d6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..0831e973ae --- /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 0000000000..0c8d1d805f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Conditional.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..3067372fd3 --- /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 0000000000..ed2ddf8b42 --- /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 0000000000..e5855000bc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..7da6bfc92d --- /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 0000000000..7b0b3d3fe7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromNestedIf_Unconditional.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..ba184391d3 --- /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 0000000000..b37d3379c2 --- /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 0000000000..9ea19ca1e5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..53e20063cf --- /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 0000000000..fe32b0fd7b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseBody.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..3553544431 --- /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 0000000000..f198b0001b --- /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 0000000000..58c449923e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..689eb89727 --- /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 0000000000..ef47d6877a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchCaseDirect.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..27341ffd0d --- /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 0000000000..b37d3379c2 --- /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 0000000000..9ea19ca1e5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..53e20063cf --- /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 0000000000..fe32b0fd7b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultBody.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..b40a8bcfc4 --- /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 0000000000..b37d3379c2 --- /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 0000000000..9ea19ca1e5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..53e20063cf --- /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 0000000000..fe32b0fd7b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_SwitchBreak_FromSwitchDefaultIsMerge.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..8caf6ec2b3 --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_DupConditionalBranch.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..9aa501431c --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_FalseOnlyBranch.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..f1b8f28d93 --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_IgnoreStaticalyUnreachable.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..c552ef2782 --- /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 0000000000..856a956d55 --- /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 0000000000..f5d3c1be3d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..8b592e73d0 --- /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 0000000000..dfd6d9e6b1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_KillIsDeadEnd.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..058815dfa8 --- /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 0000000000..7fbc796d87 --- /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 0000000000..baeb119c5b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..d7eea0c329 --- /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 0000000000..304252cb42 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreak.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var 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 0000000000..edd9c3f689 --- /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 0000000000..c38af3d8e7 --- /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 0000000000..8f73d74c72 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..f6d836451c --- /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 0000000000..ff57f2f52a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakIf.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..3fda991b48 --- /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 0000000000..56dedb5b01 --- /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 0000000000..11d5e00de9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..21d52a4042 --- /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 0000000000..5b862df0ff --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasBreakUnless.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var 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 0000000000..8d8c84a349 --- /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 0000000000..218e1b391e --- /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 0000000000..e83d11c916 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..0a750f4da4 --- /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 0000000000..dd4e39014b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueIf.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..7f67ef036c --- /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 0000000000..b81a2e5575 --- /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 0000000000..44b0a05dbd --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..6ccc679d8d --- /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 0000000000..1f6d3c32df --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_BodyHasContinueUnless.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var 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 0000000000..c840e1631e --- /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 0000000000..aca28cee85 --- /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 0000000000..3d8920aa04 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..84909b254a --- /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 0000000000..3ce9f4e4f5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..823cbc9578 --- /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 0000000000..c38af3d8e7 --- /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 0000000000..8f73d74c72 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..f6d836451c --- /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 0000000000..ff57f2f52a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Break.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..c74a3e853b --- /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 0000000000..218e1b391e --- /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 0000000000..e83d11c916 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..0a750f4da4 --- /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 0000000000..dd4e39014b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_If_Continue.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..af9c6c442f --- /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 0000000000..514e58323a --- /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 0000000000..b6fc2ae5e9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..e2b50d501b --- /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 0000000000..8083282e48 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var 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 0000000000..76c990b56f --- /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 0000000000..969b7d5961 --- /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 0000000000..12d13bbad7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +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 0000000000..3501c09a8a --- /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 0000000000..593d51271a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Body_Switch_CaseContinues.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var 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 0000000000..1e01ba639e --- /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 0000000000..b39c5d26dc --- /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 0000000000..a4a4352770 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..0ca7bb7a00 --- /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 0000000000..6dc2d6fb4e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_ContainsIf.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..7c963310ef --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakIf.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..2af20196f5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakIf.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var 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 0000000000..bb14141909 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakUnless.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..99f55320c3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_HasBreakUnless.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..d09a0c3661 --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Continue_Sequence.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..9a8f07b8c0 --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakIf.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..13ad50c0b6 --- /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 0000000000..53d908caf2 --- /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 0000000000..fc2a957ba6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..e406af24de --- /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 0000000000..d089493867 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..8e2976eb76 --- /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 0000000000..56c69c81d7 --- /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 0000000000..82f6bbadb7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..60462beb19 --- /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 0000000000..de05e863d5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var 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 0000000000..d5bccbce4c --- /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 0000000000..d22165f289 --- /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 0000000000..6432e877c8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +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 0000000000..074475e980 --- /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 0000000000..d79060fd0e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerBreak.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var 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 0000000000..35a7812d5c --- /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 0000000000..f51bd41578 --- /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 0000000000..8ec3732451 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.msl @@ -0,0 +1,28 @@ +#include + +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 0000000000..f8d4894cdf --- /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 0000000000..c39e75bb63 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinue.spvasm.expected.wgsl @@ -0,0 +1,26 @@ +var 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 0000000000..9bcadbcab2 --- /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 0000000000..72d7f4f065 --- /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 0000000000..3785f50f9c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +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 0000000000..f59ea7d7dc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_Loop_InnerContinueBreaks.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var 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 0000000000..ed99bd2cd5 --- /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 0000000000..bf1cd07b1e --- /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 0000000000..598fdda58b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..abe0206802 --- /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 0000000000..8c64952303 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_DupInfinite.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..6970ee6b4f --- /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 0000000000..bf1cd07b1e --- /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 0000000000..598fdda58b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..abe0206802 --- /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 0000000000..8c64952303 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Infinite.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..1143fd00b5 --- /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 0000000000..a6998acf3c --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_SingleBlock_Simple.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..97e73c6387 --- /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 0000000000..b6dc56035c --- /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 0000000000..e9200c2f60 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +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 0000000000..26fad70ff4 --- /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 0000000000..1e8916d5c6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.wgsl @@ -0,0 +1,26 @@ +var 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 0000000000..87bdbc830f --- /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 0000000000..bf4b8f3218 --- /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 0000000000..7b508c833d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +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 0000000000..85b15966a8 --- /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 0000000000..70134797fd --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.wgsl @@ -0,0 +1,27 @@ +var 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 0000000000..44fb4d92fc --- /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 0000000000..1739c3303f --- /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 0000000000..2384b83fe4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..6704967ebb --- /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 0000000000..f60e6aee00 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_Contains_If.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var 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 0000000000..201a230533 --- /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 0000000000..9bc5b7f0df --- /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 0000000000..df4749b5f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +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 0000000000..602dc8b24a --- /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 0000000000..fdc81898f4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..104f8e5b6f --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_OneBlock.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..f74f0f2d13 --- /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 0000000000..b1096342ba --- /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 0000000000..04dcab3b3d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..021ce3f76a --- /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 0000000000..a4faff3bdc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_ReorderSequence.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..61a0f7b528 --- /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 0000000000..7c3b265d91 --- /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 0000000000..3d7085133d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..782c4e667f --- /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 0000000000..13fa49ddec --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectConditionalBranchOrder.spvasm.expected.wgsl @@ -0,0 +1,14 @@ +var 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 0000000000..92feaa3487 --- /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 0000000000..790a128400 --- /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 0000000000..151be92d7b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..5a7d864ea3 --- /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 0000000000..6e09415ddf --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var 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 0000000000..a74bcc111e --- /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 0000000000..1d875732b9 --- /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 0000000000..12098b9110 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..222e91c80f --- /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 0000000000..8da965c803 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var 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 0000000000..d6e1cb3d3c --- /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 0000000000..1a011d02ad --- /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 0000000000..98d92c0671 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..985caf60d3 --- /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 0000000000..3a77a68b32 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var 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 0000000000..3f26450af2 --- /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 0000000000..790a128400 --- /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 0000000000..151be92d7b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..5a7d864ea3 --- /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 0000000000..6e09415ddf --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var 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 0000000000..ab38e35281 --- /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 0000000000..9313bcaf5b --- /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 0000000000..00308e922e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..82231429c5 --- /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 0000000000..b96a78670a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchOrderNaturallyReversed.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..24a84a430d --- /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 0000000000..9313bcaf5b --- /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 0000000000..00308e922e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..82231429c5 --- /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 0000000000..b96a78670a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_SwitchWithDefaultOrderNaturallyReversed.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..65363f7d14 --- /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 0000000000..3e5b1e27c8 --- /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 0000000000..ee56619334 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..028002671e --- /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 0000000000..df36f0780d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..42756b2cb6 --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_TrueOnlyBranch.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..459e5d719f --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_UnreachableIsDeadEnd.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..bf62778bcb --- /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 0000000000..9aa4fae3a7 --- /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 0000000000..7b33b3f271 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..7b2d60892d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnFalse.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var 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 0000000000..25a362405b --- /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 0000000000..c917259e43 --- /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 0000000000..d43d445e7d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..62e60af3cc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_MultiBlock_LoopBreak_OnTrue.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..d5e84108ff --- /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 0000000000..fca07cb75a --- /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 0000000000..36e1a7cd9a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..235dbca6dd --- /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 0000000000..8a3597aeef --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_Back.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..be047b734f --- /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 0000000000..c02c6011dc --- /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 0000000000..7a859d1a31 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..7c6b9df084 --- /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 0000000000..93701b8493 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnFalse.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..1aa956e9e7 --- /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 0000000000..fa7b0f4955 --- /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 0000000000..de9516f97a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..2e57d728ef --- /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 0000000000..f103a4e5aa --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Back_SingleBlock_LoopBreak_OnTrue.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..571f3b23e9 --- /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 0000000000..6f8deff2e0 --- /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 0000000000..43efbe2779 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +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 0000000000..b0ed0677cd --- /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 0000000000..798257bfca --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var 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 0000000000..f26962f79b --- /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 0000000000..23aeadbdd3 --- /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 0000000000..2df17ccf94 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..fcce539c8d --- /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 0000000000..8b32d79fd4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Conditional_EmptyContinuing.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..06f56025e9 --- /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 0000000000..beee82e010 --- /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 0000000000..58dfda13e2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..675d575535 --- /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 0000000000..f238b48ca1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_AfterHeader_Unconditional.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var 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 0000000000..9175999fb4 --- /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 0000000000..f67a99bc8d --- /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 0000000000..5b3988b83b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..c7340c60eb --- /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 0000000000..94759b74a5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Continue_FromHeader.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..3ab896b52a --- /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 0000000000..dbe01fcc96 --- /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 0000000000..6109a63ddb --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.msl @@ -0,0 +1,42 @@ +#include + +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 0000000000..6cc516b57a --- /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 0000000000..bbcdec395b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnFalse.spvasm.expected.wgsl @@ -0,0 +1,35 @@ +var 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 0000000000..206bf95982 --- /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 0000000000..ab335c374c --- /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 0000000000..dc94b107cc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.msl @@ -0,0 +1,43 @@ +#include + +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 0000000000..f7d2e83e09 --- /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 0000000000..0d15505147 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Fallthrough_OnTrue.spvasm.expected.wgsl @@ -0,0 +1,36 @@ +var 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 0000000000..ff3bd8785e --- /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 0000000000..9dc00a2ac5 --- /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 0000000000..29d56005d1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..900b64558f --- /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 0000000000..1ec7161b36 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnFalse.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var 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 0000000000..fae353418c --- /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 0000000000..b460af93dd --- /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 0000000000..b87c418e97 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +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 0000000000..699222bacf --- /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 0000000000..7d49a90b43 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_Forward_OnTrue.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var 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 0000000000..976f62531b --- /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 0000000000..df6c944983 --- /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 0000000000..7ccdd8727f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.msl @@ -0,0 +1,32 @@ +#include + +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 0000000000..5d84afaeac --- /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 0000000000..243ee9f1e0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnFalse.spvasm.expected.wgsl @@ -0,0 +1,27 @@ +var 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 0000000000..f316ebf5c4 --- /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 0000000000..c33fba8187 --- /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 0000000000..2cf4fe7be0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.msl @@ -0,0 +1,33 @@ +#include + +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 0000000000..e0c9b64ac6 --- /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 0000000000..d9e895c0cf --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Continue_IfBreak_OnTrue.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +var 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 0000000000..0560ea2d94 --- /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 0000000000..e0369bc2f1 --- /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 0000000000..38398b8eba --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.msl @@ -0,0 +1,28 @@ +#include + +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 0000000000..94fbf176fd --- /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 0000000000..af1f3f984b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..449eea5b93 --- /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 0000000000..8f48fc58c8 --- /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 0000000000..6c622f5e80 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..8d04cde7fa --- /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 0000000000..7201e5093f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Forward_Forward_Same.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..df99edb5c6 --- /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 0000000000..e96888afd0 --- /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 0000000000..12e68abb82 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..9a0ac9d895 --- /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 0000000000..d8631ef044 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_IfBreak_IfBreak_Same.spvasm.expected.wgsl @@ -0,0 +1,14 @@ +var 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 0000000000..c2e06a0637 --- /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 0000000000..9eee372775 --- /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 0000000000..1ea53a7be9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.msl @@ -0,0 +1,33 @@ +#include + +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 0000000000..2cfcfd1ba7 --- /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 0000000000..8912427fbc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnFalse.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +var 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 0000000000..dfa3f21974 --- /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 0000000000..2d4e25e142 --- /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 0000000000..3bfddee162 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.msl @@ -0,0 +1,33 @@ +#include + +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 0000000000..2f9440bfb1 --- /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 0000000000..eb40ee147f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Continue_OnTrue.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +var 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 0000000000..0c6bfe3d17 --- /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 0000000000..e0b407e28a --- /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 0000000000..c422f732c5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..57535ab281 --- /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 0000000000..e4b5505aaf --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnFalse.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var 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 0000000000..9c99887c0f --- /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 0000000000..c3276ff710 --- /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 0000000000..9f98375218 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +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 0000000000..d8d4d7f356 --- /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 0000000000..745d1a4014 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_Forward_OnTrue.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var 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 0000000000..a8c3596255 --- /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 0000000000..ced9780e21 --- /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 0000000000..929ba549a2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..81947d8e0b --- /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 0000000000..40faeefc0b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_MultiBlock_LoopBreak.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..1b9c9e910e --- /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 0000000000..fb4249114b --- /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 0000000000..4f56341e47 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..2b2d072a0c --- /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 0000000000..7fd500cb51 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopBreak_SingleBlock_LoopBreak.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var 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 0000000000..cb4a1ac1b1 --- /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 0000000000..13896f7866 --- /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 0000000000..b3374cd139 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +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 0000000000..61aedfb7d3 --- /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 0000000000..674013a674 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_LoopContinue_FromSwitch.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var 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 0000000000..12cb452ba8 --- /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 0000000000..956ef590a9 --- /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 0000000000..cf4d143b0e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.msl @@ -0,0 +1,39 @@ +#include + +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 0000000000..d14f8c81dd --- /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 0000000000..e1975e3f07 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse.spvasm.expected.wgsl @@ -0,0 +1,32 @@ +var 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 0000000000..b31ebf482f --- /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 0000000000..08e5ba27c7 --- /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 0000000000..0d344df543 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.msl @@ -0,0 +1,38 @@ +#include + +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 0000000000..19a499dbce --- /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 0000000000..b926d1a79c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue.spvasm.expected.wgsl @@ -0,0 +1,31 @@ +var 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 0000000000..7f1d386af8 --- /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 0000000000..6096ec8402 --- /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 0000000000..3360c559b5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +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 0000000000..2d65a6fc7a --- /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 0000000000..205de3c5ba --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.wgsl @@ -0,0 +1,26 @@ +var 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 0000000000..5991963df8 --- /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 0000000000..9233203e1b --- /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 0000000000..c49bf0bf8e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.msl @@ -0,0 +1,32 @@ +#include + +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 0000000000..d5913cf7cd --- /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 0000000000..876e799569 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.wgsl @@ -0,0 +1,27 @@ +var 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 0000000000..07e5f1e939 --- /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 0000000000..46d4baad4b --- /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 0000000000..c6dd3c8840 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.msl @@ -0,0 +1,28 @@ +#include + +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 0000000000..270a5b6c43 --- /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 0000000000..7b790f5eb8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..960b81e79a --- /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 0000000000..379755bb5e --- /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 0000000000..b6e71c2c9b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..426a8c524a --- /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 0000000000..d0b6571e7b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var 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 0000000000..1e9cf9efdf --- /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 0000000000..dc27829a13 --- /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 0000000000..722311b642 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..3533650958 --- /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 0000000000..8452e21230 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_LastInCase.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..f2219cac3d --- /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 0000000000..3b5b5badca --- /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 0000000000..d88cc2bbb9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..c451eb0a77 --- /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 0000000000..3ac298c032 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_SwitchBreak_NotLastInCase.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var 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 0000000000..fb140073f0 --- /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 0000000000..ede6455343 --- /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 0000000000..323585ca35 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..1946f344b8 --- /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 0000000000..a79986685a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_MultiBlockLoop.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..24b8acaa78 --- /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 0000000000..8142347afd --- /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 0000000000..e5e10d8f19 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..1a3bdd2b20 --- /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 0000000000..9aaeb0de45 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_BackEdge_SingleBlockLoop.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var 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 0000000000..6e9d1ebe3c --- /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 0000000000..e0369bc2f1 --- /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 0000000000..38398b8eba --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.msl @@ -0,0 +1,28 @@ +#include + +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 0000000000..94fbf176fd --- /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 0000000000..af1f3f984b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..f149ceb045 --- /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 0000000000..8f48fc58c8 --- /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 0000000000..6c622f5e80 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..8d04cde7fa --- /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 0000000000..7201e5093f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Forward.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..e4c2aa426e --- /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 0000000000..eef0417d0c --- /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 0000000000..62705b4555 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..98ecfb490f --- /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 0000000000..6f1ec5632e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromElse.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..b498db98ae --- /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 0000000000..f5eb775919 --- /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 0000000000..ca14976d52 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..01aa6d195c --- /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 0000000000..7ebbcd860a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_IfBreak_FromThen.spvasm.expected.wgsl @@ -0,0 +1,14 @@ +var 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 0000000000..3d77f57a4b --- /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 0000000000..5bdbb28aea --- /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 0000000000..0891fc74b4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..33ba9053fe --- /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 0000000000..bb3843eb7f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..acd21d5fe9 --- /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 0000000000..a783e6d0f5 --- /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 0000000000..d81b5d4fd7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..dc5a5c8964 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopBreak_MultiBlockLoop_FromContinueConstructEnd_Conditional.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var 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 0000000000..da27b59c77 --- /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 0000000000..4d787ec2db --- /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 0000000000..54b32eab76 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..ce3dbc4713 --- /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 0000000000..0d66f877b6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_BeforeLast.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..abbbadb84c --- /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 0000000000..13896f7866 --- /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 0000000000..b3374cd139 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +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 0000000000..61aedfb7d3 --- /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 0000000000..674013a674 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_FromSwitch.spvasm.expected.wgsl @@ -0,0 +1,29 @@ +var 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 0000000000..2a193dd0d5 --- /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 0000000000..9ec145299e --- /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 0000000000..7c64f18804 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..8f8c047d4c --- /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 0000000000..f23ea02b1a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_LoopContinue_LastInLoopConstruct.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var 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 0000000000..a40602a1f5 --- /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 0000000000..dc27829a13 --- /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 0000000000..722311b642 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..3533650958 --- /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 0000000000..8452e21230 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_LastInCase.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..266450714d --- /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 0000000000..3b5b5badca --- /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 0000000000..d88cc2bbb9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..c451eb0a77 --- /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 0000000000..3ac298c032 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_SwitchBreak_NotLastInCase.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var 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 0000000000..c4f3f8364d --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopBreak.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..05260051e4 --- /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 0000000000..d31cc7fef3 --- /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 0000000000..6ea82c98c1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..8c7bc0c8cc --- /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 0000000000..169951e9ff --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_LoopContinue.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..30a1bf60ae --- /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 0000000000..ea27551423 --- /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 0000000000..1d512d2d4f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..0d6e7cefc4 --- /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 0000000000..419b2af974 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_FalseBranch_SwitchBreak.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var 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 0000000000..ff8c2cba0b --- /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 0000000000..700f4dc702 --- /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 0000000000..58c9960d09 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +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 0000000000..69248ffac7 --- /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 0000000000..0f34f3fd61 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromElse_ForwardWithinElse.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +var 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 0000000000..ff03e76f58 --- /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 0000000000..2ff2452776 --- /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 0000000000..7f66270cf2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.msl @@ -0,0 +1,47 @@ +#include + +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 0000000000..49de3eafcf --- /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 0000000000..66666c4a83 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThenWithForward_FromElseWithForward_AlsoPremerge.spvasm.expected.wgsl @@ -0,0 +1,44 @@ +var 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 0000000000..8bcbb0b7b6 --- /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 0000000000..02ac4d81ad --- /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 0000000000..a337efea1e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +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 0000000000..c20c840eae --- /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 0000000000..77150f0fb4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfBreak_FromThen_ForwardWithinThen.spvasm.expected.wgsl @@ -0,0 +1,28 @@ +var 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 0000000000..4c03e813ce --- /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 0000000000..53d908caf2 --- /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 0000000000..fc2a957ba6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..e406af24de --- /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 0000000000..d089493867 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..3925c551c7 --- /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 0000000000..1daa202178 --- /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 0000000000..9c914e2cc3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..88d083a4f2 --- /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 0000000000..51849d6420 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Else_Premerge.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..7e396bc28c --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Empty.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..06aa93834e --- /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 0000000000..fb80d51325 --- /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 0000000000..2edb037288 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..86dd802ecd --- /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 0000000000..3c6a28fdba --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Nest_If.spvasm.expected.wgsl @@ -0,0 +1,26 @@ +var 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 0000000000..cdc5267455 --- /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 0000000000..e920c30c94 --- /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 0000000000..afddae1ce8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..2b5ca6c241 --- /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 0000000000..1af5e0f5f7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_NoThen_Else.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..efd46aa649 --- /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 0000000000..ef780920ca --- /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 0000000000..243de2f653 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..91394e38b8 --- /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 0000000000..180d5b9467 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var 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 0000000000..18bce40051 --- /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 0000000000..455b652006 --- /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 0000000000..07bb22c1be --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..eaea586b67 --- /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 0000000000..9d88c7ca59 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Else_Premerge.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var 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 0000000000..94de7ced73 --- /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 0000000000..30825b514d --- /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 0000000000..b2f523db8c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..25edd8c5ef --- /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 0000000000..4d979fd92d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_NoElse.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..d2550ed331 --- /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 0000000000..78aa30f4db --- /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 0000000000..422a89534b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..18d9d5e03f --- /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 0000000000..d2055a2909 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_If_Then_Premerge.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..07cc63af29 --- /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 0000000000..e82ac978bb --- /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 0000000000..bfbb6f435d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..5abbaedf6a --- /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 0000000000..1da9df06c2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideIf.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var 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 0000000000..85a2d5bc05 --- /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 0000000000..44f3307ab3 --- /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 0000000000..76bdb15f59 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..1e9c1fa864 --- /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 0000000000..7fb5f4f1ea --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var 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 0000000000..bbeb4d13e3 --- /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 0000000000..856a956d55 --- /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 0000000000..f5d3c1be3d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..8b592e73d0 --- /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 0000000000..dfd6d9e6b1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Kill_TopLevel.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..75c08a0119 --- /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 0000000000..da78328faf --- /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 0000000000..6c3b4c46f6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +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 0000000000..611297117d --- /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 0000000000..53006f111f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_LoopInternallyDiverge_Simple.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var 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 0000000000..e75b918dae --- /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 0000000000..5bdbb28aea --- /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 0000000000..0891fc74b4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..33ba9053fe --- /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 0000000000..bb3843eb7f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyAlwaysBreaks.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..20922b4362 --- /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 0000000000..c279966056 --- /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 0000000000..c26cd2d2a8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..ab8127f669 --- /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 0000000000..68654ddc0c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..d051f5fe7b --- /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 0000000000..3f0228bb21 --- /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 0000000000..d40dfe7d79 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..fb79a99b1f --- /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 0000000000..969c912ecf --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var 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 0000000000..8da1da9c36 --- /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 0000000000..ec8fddbcb0 --- /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 0000000000..9b16297e47 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..f2da94e28f --- /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 0000000000..530220dcc6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var 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 0000000000..617d2a1684 --- /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 0000000000..0fa38cbeb7 --- /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 0000000000..bb370efb5f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..c881b61864 --- /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 0000000000..b7033461e1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..b789cb91fd --- /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 0000000000..6fa8cc9784 --- /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 0000000000..a395bdb914 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..22190e0d1e --- /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 0000000000..604b078862 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_FalseToBody_TrueBreaks.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..36d7fd68d2 --- /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 0000000000..b6e396b396 --- /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 0000000000..46d558e645 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..31320d44f3 --- /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 0000000000..61c17a199a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..3d15ac76d7 --- /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 0000000000..4d787ec2db --- /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 0000000000..54b32eab76 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..ce3dbc4713 --- /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 0000000000..0d66f877b6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_NestedIfContinue.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..56b2d5c721 --- /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 0000000000..d040ced9cc --- /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 0000000000..e5e10c1e37 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..fe91b41f96 --- /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 0000000000..dbbeae8a03 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Never.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..45056eb2e5 --- /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 0000000000..b9db322a83 --- /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 0000000000..ea86c1a568 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..b03b09109b --- /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 0000000000..533da6eefa --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_BothBackedge.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..e79cda5e02 --- /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 0000000000..fe271d8a25 --- /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 0000000000..1c7f5e73a4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..9fde6f56a4 --- /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 0000000000..a02819eb09 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_FalseBackedge.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..89bc6523dd --- /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 0000000000..77f5bbcce0 --- /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 0000000000..0544bb1cb1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..4719efe03a --- /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 0000000000..7f67521146 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_TrueBackedge.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..5a49c7a7c1 --- /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 0000000000..b9db322a83 --- /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 0000000000..ea86c1a568 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..b03b09109b --- /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 0000000000..533da6eefa --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_SingleBlock_UnconditionalBackege.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..bcb06650d5 --- /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 0000000000..6fa8cc9784 --- /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 0000000000..a395bdb914 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..22190e0d1e --- /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 0000000000..604b078862 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_TrueToBody_FalseBreaks.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..5d0dd06b83 --- /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 0000000000..ba79b953ce --- /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 0000000000..5d8fe8ae66 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..4b540e5f3a --- /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 0000000000..a031175f12 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_ContinueNestIf.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +var 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 0000000000..44f07bba2c --- /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 0000000000..4553fdc211 --- /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 0000000000..22de66c8e4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..7606e95d41 --- /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 0000000000..4f1ff80b2e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_MultiBlockContinue.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..5532978249 --- /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 0000000000..f002ff9292 --- /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 0000000000..b9531c1f2c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..76a5593cde --- /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 0000000000..f5f8f3aa67 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Loop_Unconditional_Body_SingleBlockContinue.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var 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 0000000000..184c77488a --- /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 0000000000..8164e48f16 --- /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 0000000000..aa296637a7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..d409cacf34 --- /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 0000000000..092387799a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_InsideIf.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..966da29de0 --- /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 0000000000..62aef6740c --- /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 0000000000..b3e4ce118d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..b2d369d5ec --- /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 0000000000..fc4233f4fe --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_Loop.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..b0de0cd2dd --- /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 0000000000..3e97fbbd6d --- /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 0000000000..379405d7d1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..d37a80bd50 --- /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 0000000000..9aecfcd478 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_ReturnValue_TopLevel.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..a81d794f80 --- /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 0000000000..dc451e962b --- /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 0000000000..fb3b83a9d6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..9558a9a5a9 --- /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 0000000000..4da92df40a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideIf.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var 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 0000000000..e8f8b51dc9 --- /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 0000000000..b9dbbea6a0 --- /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 0000000000..d80c8faa13 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..f445af64a3 --- /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 0000000000..3e1a55f23b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_InsideLoop.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var 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 0000000000..c32bbbe5f9 --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Return_TopLevel.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..91978cbf23 --- /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 0000000000..594c316015 --- /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 0000000000..3e10b9fe06 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.msl @@ -0,0 +1,32 @@ +#include + +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 0000000000..c4d6470256 --- /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 0000000000..fb63bf364a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_SintValue.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var 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 0000000000..8a6f62e730 --- /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 0000000000..752ebc82ca --- /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 0000000000..1fd89e91fe --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.msl @@ -0,0 +1,32 @@ +#include + +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 0000000000..dc8924f800 --- /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 0000000000..fcfc59332c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_Case_UintValue.spvasm.expected.wgsl @@ -0,0 +1,25 @@ +var 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 0000000000..aded929443 --- /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 0000000000..808a33f7e3 --- /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 0000000000..e6c97a111c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..51a1ac29ec --- /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 0000000000..9f0eaa912b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_NoDupCases.spvasm.expected.wgsl @@ -0,0 +1,23 @@ +var 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 0000000000..b4968bb2d9 --- /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 0000000000..41e966a0b8 --- /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 0000000000..e78e905446 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.msl @@ -0,0 +1,32 @@ +#include + +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 0000000000..c8eacd330e --- /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 0000000000..b933eab5de --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.wgsl @@ -0,0 +1,26 @@ +var 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 0000000000..cac0e455cd --- /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 0000000000..3f4408c2b2 --- /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 0000000000..d0df57a407 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..c89d848064 --- /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 0000000000..9e4b23f611 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_CasesWithDup.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var 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 0000000000..8a052ae7ea --- /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 0000000000..1fcc43096c --- /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 0000000000..cfffd8c7bb --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..330516e411 --- /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 0000000000..5d5acaca98 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_NoCases.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..d0e14191ae --- /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 0000000000..dc27829a13 --- /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 0000000000..722311b642 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..3533650958 --- /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 0000000000..8452e21230 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_OneCase.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..d0831810d5 --- /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 0000000000..acad3e5fcd --- /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 0000000000..4fdb0f6dcd --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.msl @@ -0,0 +1,28 @@ +#include + +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 0000000000..1a30d6c587 --- /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 0000000000..9668adb902 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsMerge_TwoCases.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var 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 0000000000..fa8b95e667 --- /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 0000000000..3107abb904 --- /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 0000000000..a0c4009073 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..dc36d5bcca --- /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 0000000000..76e6581e00 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_LoopContinue.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..b840e98100 --- /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 0000000000..f7b800d2e3 --- /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 0000000000..0b3ef61dd9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..79f2cfc524 --- /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 0000000000..f65408d62d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_TrueBranch_SwitchBreak.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..7caca1085c --- /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 0000000000..b169b4582c --- /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 0000000000..cb0c2e9de9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..ff27b30ea4 --- /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 0000000000..99dd21f634 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InNonVoidFunction.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..ba52a288db --- /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 0000000000..dc451e962b --- /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 0000000000..fb3b83a9d6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..9558a9a5a9 --- /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 0000000000..4da92df40a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideIf.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var 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 0000000000..8756f4ae0d --- /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 0000000000..b9dbbea6a0 --- /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 0000000000..d80c8faa13 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..f445af64a3 --- /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 0000000000..3e1a55f23b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_InsideLoop.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +var 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 0000000000..cbd262d5ea --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Unreachable_TopLevel.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..3703e82338 --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ElseOnly.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..90c868e8f1 --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopBreak_Ok.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..4f0040dcb8 --- /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 0000000000..d31cc7fef3 --- /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 0000000000..6ea82c98c1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..8c7bc0c8cc --- /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 0000000000..169951e9ff --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_LoopContinue_Ok.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..fd6113666c --- /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 0000000000..ea27551423 --- /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 0000000000..1d512d2d4f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..0d6e7cefc4 --- /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 0000000000..419b2af974 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_FalseBranch_SwitchBreak_Ok.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +var 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 0000000000..f791332510 --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_IfOnly.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..6ff6725ec3 --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_NoIf.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..971748204a --- /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 0000000000..6280e0e88c --- /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 0000000000..ec038a3f5c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..0979ee2395 --- /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 0000000000..4abd08ff58 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ElseDirectToThen.spvasm.expected.wgsl @@ -0,0 +1,14 @@ +var 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 0000000000..c43e8a8578 --- /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 0000000000..6280e0e88c --- /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 0000000000..ec038a3f5c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..0979ee2395 --- /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 0000000000..4abd08ff58 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_Simple.spvasm.expected.wgsl @@ -0,0 +1,14 @@ +var 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 0000000000..00b1c437ff --- /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 0000000000..6280e0e88c --- /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 0000000000..ec038a3f5c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..0979ee2395 --- /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 0000000000..4abd08ff58 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Premerge_ThenDirectToElse.spvasm.expected.wgsl @@ -0,0 +1,14 @@ +var 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 0000000000..48a2bf8076 --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_Regardless.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..26bdfacdf6 --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_ThenElse.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..23a7a13a56 --- /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 0000000000..53d908caf2 --- /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 0000000000..fc2a957ba6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..e406af24de --- /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 0000000000..d089493867 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..466dc83ffc --- /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 0000000000..3107abb904 --- /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 0000000000..a0c4009073 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..dc36d5bcca --- /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 0000000000..76e6581e00 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopContinue_Ok.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..51bf86ff5b --- /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 0000000000..f7b800d2e3 --- /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 0000000000..0b3ef61dd9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..79f2cfc524 --- /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 0000000000..f65408d62d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_SwitchBreak_Ok.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..d3d312c2f1 --- /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 0000000000..a018399c91 --- /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 0000000000..2c5820d649 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..2ab5766d41 --- /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 0000000000..f7802bd641 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var 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 0000000000..789f8356f4 --- /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 0000000000..c9cc499d6a --- /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 0000000000..53a599e150 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..64b98eec9d --- /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 0000000000..d498fcebcd --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsNotDefault.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..01c9cbfb15 --- /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 0000000000..b37d3379c2 --- /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 0000000000..9ea19ca1e5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..53e20063cf --- /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 0000000000..fe32b0fd7b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsMerge.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..3bf418c923 --- /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 0000000000..b37d3379c2 --- /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 0000000000..9ea19ca1e5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..53e20063cf --- /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 0000000000..fe32b0fd7b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_DefaultIsNotMerge.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..a517cd2275 --- /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 0000000000..8b113db276 --- /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 0000000000..7c822a37b9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..f2feb0eb89 --- /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 0000000000..2913781a3c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_ManyValuesWithSameCase.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..ae31efe625 --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_NoSwitch.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..67d4acf10f --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_FunctionIsOnlyIfSelectionAndItsMerge.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..2f4f1d5a96 --- /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 0000000000..3107abb904 --- /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 0000000000..a0c4009073 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..dc36d5bcca --- /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 0000000000..76e6581e00 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_LoopInterallyDiverge.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var 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 0000000000..a205973ae1 --- /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 0000000000..3848446f17 --- /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 0000000000..94480e4718 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..2368871c48 --- /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 0000000000..c4f46270c9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoMultiBlockLoopHeader.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..235ded2009 --- /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 0000000000..4058d37e01 --- /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 0000000000..94480e4718 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..2368871c48 --- /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 0000000000..c4f46270c9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MergeBlockIsAlsoSingleBlockLoop.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..762da210e7 --- /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 0000000000..a6998acf3c --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..c616065680 --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsNotContinue.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..3b21fe3ba0 --- /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 0000000000..1739c3303f --- /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 0000000000..2384b83fe4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..6704967ebb --- /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 0000000000..f60e6aee00 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_If.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +var 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 0000000000..6ebd600ae5 --- /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 0000000000..0033e41dee --- /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 0000000000..3869dc82f5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..e669414685 --- /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 0000000000..bcc1decfb8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_MultiBlockLoop.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..990697f765 --- /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 0000000000..38d49134f1 --- /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 0000000000..3869dc82f5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..e669414685 --- /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 0000000000..bcc1decfb8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_SingleBlockLoop.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..c453eef799 --- /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 0000000000..905bf2e6b7 --- /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 0000000000..34d66769aa --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..814f5d4109 --- /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 0000000000..ac2fe60207 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_If_Switch.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..a7548d7111 --- /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 0000000000..b39c5d26dc --- /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 0000000000..a4a4352770 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..0ca7bb7a00 --- /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 0000000000..6dc2d6fb4e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_LoopContinue_If.spvasm.expected.wgsl @@ -0,0 +1,21 @@ +var 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 0000000000..d24020dd74 --- /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 0000000000..aca28cee85 --- /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 0000000000..3d8920aa04 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..84909b254a --- /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 0000000000..3ce9f4e4f5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_If.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..0acd695a08 --- /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 0000000000..b858639c25 --- /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 0000000000..82f6bbadb7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..60462beb19 --- /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 0000000000..de05e863d5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Loop_Loop.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var 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 0000000000..28744d2306 --- /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 0000000000..3aae378df2 --- /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 0000000000..7524d03c7f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +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 0000000000..590fccb6e2 --- /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 0000000000..3a7d97be65 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_Nest_Switch_If.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +var 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 0000000000..a9b7461a02 --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_MultiBlock.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..3e3fe5f942 --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_OuterConstructIsFunction_SingleBlock.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..24b392a0b9 --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_PaddingBlocksBeforeAndAfterStructuredConstruct.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..48e5c26f66 --- /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 0000000000..a6998acf3c --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SingleBlockLoop.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..0fd8734517 --- /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 0000000000..77d4580904 --- /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 0000000000..edafec261d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..d3cfeb15d8 --- /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 0000000000..8509af3b6b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_LabelControlFlowConstructs_SwitchSelection.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +var 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 0000000000..99655204c6 --- /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 0000000000..bf1cd07b1e --- /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 0000000000..598fdda58b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..abe0206802 --- /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 0000000000..8c64952303 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsHeader.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..8ceeb664ac --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_Branch.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..d1c8fbf9d3 --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_MultiBlockLoop_ContinueIsNotHeader_BranchConditional.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..b3031ae9c7 --- /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 0000000000..a6998acf3c --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodLoopMerge_SingleBlockLoop.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..b686e85459 --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_BranchConditional.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..9f0e2979eb --- /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 0000000000..b37d3379c2 --- /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 0000000000..9ea19ca1e5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..53e20063cf --- /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 0000000000..fe32b0fd7b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_GoodSelectionMerge_Switch.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..f49c3e8a06 --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_RegisterMerges_NoMerges.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..00c32d6475 --- /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 0000000000..a6998acf3c --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..5a602a2157 --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_HasSiblingLoop.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..849d3bbae5 --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_NotAContinue.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..c54dceb0ec --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_Null.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..4d84389f4f --- /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 0000000000..a6998acf3c --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_SiblingLoopConstruct_SingleBlockLoop.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..04f7fd5a80 --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_If.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..3506a29c06 --- /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 0000000000..856a956d55 --- /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 0000000000..f5d3c1be3d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..8b592e73d0 --- /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 0000000000..dfd6d9e6b1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Kill.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..921dbafef3 --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_Simple.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..8f0a252788 --- /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 0000000000..a6998acf3c --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Loop_SingleBlock.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..3ea0da9119 --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Sequence.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..7affba139f --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_SingleBlock.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..4269988a0e --- /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 0000000000..08cf13fc88 --- /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 0000000000..9b574acd88 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..fb94495b63 --- /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 0000000000..d39a7b8b25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +var 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 0000000000..a58a785b6a --- /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 0000000000..a126c6fabd --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..4486cdae80 --- /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 0000000000..bb48a6a163 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Unreachable.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +var 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 0000000000..481638022f --- /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 0000000000..ad01345bd2 --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_MultiBlockLoop_Good.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..ba80266814 --- /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 0000000000..581055be50 --- /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 0000000000..4661d814d2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..857ac95ccd --- /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 0000000000..b9d9b8c744 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_Selection_Good.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..2e55e951c2 --- /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 0000000000..a6998acf3c --- /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 0000000000..52904a0847 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6f107a4b79 --- /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 0000000000..834ea7077b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserCFGTest_VerifyHeaderContinueMergeOrder_SingleBlockLoop_Good.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var 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 0000000000..18c4e4d775 --- /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 0000000000..e89cc85a5c --- /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 0000000000..7256baf1b2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_AnonymousVars.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..a3c9176d15 --- /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 0000000000..4c3887f23c --- /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; +}; + +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 0000000000..948446f932 --- /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 0000000000..6ac840c2d6 --- /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 0000000000..fc01ca2d86 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..cc3cfdd8e2 --- /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 0000000000..db2452e031 --- /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; +}; + +fn main_1() { + var x_200 : array = array(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 0000000000..88b0b9a65a --- /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 0000000000..39503fc54f --- /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 0000000000..f097d24fa0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..1825b90428 --- /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 0000000000..a517f834cf --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +type Arr = [[stride(16)]] array; + +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 0000000000..6692c67e82 --- /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 0000000000..5daca9f933 --- /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 0000000000..3a99c0f754 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..ef2915c1ed --- /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 0000000000..be10f25fb2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Alias_Null.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +type Arr = [[stride(16)]] array; + +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 0000000000..3461475acd --- /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 0000000000..c51a182c06 --- /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 0000000000..de6f9c2ac6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ArrayInitializer_Null.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..0aa594f0e1 --- /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 0000000000..b8e3ed6860 --- /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; +}; + +fn main_1() { + var x_200 : array = array(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 0000000000..873022b67e --- /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 0000000000..529c7bdbe5 --- /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 0000000000..74976c4d7c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_Decorate_RelaxedPrecision.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..d5ae00fea6 --- /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 0000000000..dd324f6ffb --- /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 0000000000..1da4495975 --- /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 0000000000..b5e78948a6 --- /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 0000000000..f23bd3f621 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MatrixInitializer.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..4d0d45ee31 --- /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 0000000000..20a04e2df7 --- /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; +}; + +fn main_1() { + var x_200 : mat3x2 = mat3x2(vec2(1.5, 2.0), vec2(2.0, 3.0), vec2(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 0000000000..72f94c1a8d --- /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 0000000000..bee12fd190 --- /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 0000000000..a472ed1c0b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MemberDecorate_RelaxedPrecision.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..706ab893b5 --- /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 0000000000..2018ad4db4 --- /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 0000000000..78fe67f2bf --- /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 0000000000..4b152b0034 --- /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 0000000000..516501243e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_MixedTypes.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..f12a1f61a1 --- /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 0000000000..724c200952 --- /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; +}; + +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 0000000000..439fd895d3 --- /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 0000000000..92a2bcc830 --- /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 0000000000..60e829f132 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_NamedVars.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..c4a447e089 --- /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 0000000000..391c0d5887 --- /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; +}; + +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 0000000000..9f5cf2741b --- /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 0000000000..79b82752e8 --- /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 0000000000..b353732a2c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarInitializers.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..ab7324fc9b --- /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 0000000000..f37bcb016e --- /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; +}; + +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 0000000000..86887635be --- /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 0000000000..b9e839b2f0 --- /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 0000000000..43076d2e65 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_ScalarNullInitializers.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..085f1ef01a --- /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 0000000000..2e764c2516 --- /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; +}; + +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 0000000000..ed77aa2b53 --- /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 0000000000..b9c297e7c8 --- /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 0000000000..98d5b76b85 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructDifferOnlyInMemberName.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..66cb234975 --- /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 0000000000..541f2648db --- /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 0000000000..a07c031257 --- /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 0000000000..a7c957d83a --- /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 0000000000..ac9741fbb8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..bab5b05dcb --- /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 0000000000..babd224e9a --- /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; +}; + +fn main_1() { + var x_200 : S = S(1u, 1.5, array(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 0000000000..46047cb592 --- /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 0000000000..272f7164b9 --- /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 0000000000..81ee737761 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_StructInitializer_Null.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..e406537ae1 --- /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 0000000000..a055f58dea --- /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; +}; + +fn main_1() { + var x_200 : S = S(0u, 0.0, array(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 0000000000..74d2c511cc --- /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 0000000000..4121d17aa4 --- /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 0000000000..21611dbeb6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitFunctionVariables_VectorInitializer.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..dce6b4e4fa --- /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 0000000000..ae3b8819da --- /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; +}; + +fn main_1() { + var x_200 : vec2 = vec2(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 0000000000..269e7b66f7 --- /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 0000000000..78e55ff70d --- /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 0000000000..ae93b026e1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_DefConstruct_DoesNotEncloseAllUses.spvasm.expected.msl @@ -0,0 +1,44 @@ +#include + +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 0000000000..9e59f9139f --- /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; +}; + +var 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 0000000000..c6c01818d6 --- /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 0000000000..0cf17145e4 --- /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 0000000000..1f3d451d22 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefAndUseFirstBlockIf.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..17bb5e78bb --- /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 0000000000..f557570c72 --- /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; +}; + +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 0000000000..ec5a3430b8 --- /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 0000000000..d1cbc4ca71 --- /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 0000000000..73ae2f79a2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InFunction.spvasm.expected.msl @@ -0,0 +1,27 @@ +#include + +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 0000000000..8a25980957 --- /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 0000000000..6e48a902de --- /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; +}; + +var 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 0000000000..bb8a82fce9 --- /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 0000000000..f541cf6e97 --- /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 0000000000..eda2ef3f11 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockIf_InIf.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..1f2f21209c --- /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 0000000000..39a69572f7 --- /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; +}; + +var 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 0000000000..66de322022 --- /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 0000000000..0f61ca0fd6 --- /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 0000000000..4711ae135c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialNonPointer_Hoisting_DefFirstBlockSwitch_InIf.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..c7250ddf4f --- /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 0000000000..02ec62dcdd --- /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; +}; + +var 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 0000000000..f17c229332 --- /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 0000000000..d8166c5087 --- /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 0000000000..a30ed6f91f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Defer_UsedOnceSameConstruct.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..87ef5ae7eb --- /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 0000000000..8fca7f27cb --- /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; +}; + +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 0000000000..f3a6fd6007 --- /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 0000000000..549e996024 --- /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 0000000000..223c46eb69 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedOnceDifferentConstruct.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +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 0000000000..c6832a88ac --- /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 0000000000..9dac7e41b9 --- /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; +}; + +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 0000000000..42b5933293 --- /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 0000000000..44decb4aa6 --- /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 0000000000..c207f56270 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_CombinatorialValue_Immediate_UsedTwice.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..8dce044407 --- /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 0000000000..abec2fa463 --- /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; +}; + +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 0000000000..1eea7eafd6 --- /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 0000000000..ded87d73b2 --- /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 0000000000..0c1053abd4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_CompositeInsert.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..df3fb8b7d6 --- /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 0000000000..748c68e997 --- /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; +}; + +fn main_1() { + var x_200 : vec2; + if (true) { + x_200 = vec2(0, 0); + x_200.x = 0; + } else { + return; + } + let x_201 : vec2 = 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 0000000000..ce15896859 --- /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 0000000000..f9805b7783 --- /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 0000000000..ffc6cb2634 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_UsedAsNonPtrArg.spvasm.expected.msl @@ -0,0 +1,32 @@ +#include + +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 0000000000..9c75a61370 --- /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 0000000000..99f2a9a1d1 --- /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; +}; + +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 0000000000..26ffbf1df2 --- /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 0000000000..305aab8033 --- /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 0000000000..9dd20f7c2d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Hoist_VectorInsertDynamic.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..8f2e929a9d --- /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 0000000000..f14ee0983f --- /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; +}; + +fn main_1() { + var x_200 : vec2; + if (true) { + x_200 = vec2(0, 0); + x_200[1] = 3; + } else { + return; + } + let x_201 : vec2 = 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 0000000000..8c3d4a6c72 --- /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 0000000000..7e545e0c6e --- /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 0000000000..04dbbd5098 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromElseAndThen.spvasm.expected.msl @@ -0,0 +1,52 @@ +#include + +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 0000000000..8d90b52f95 --- /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 0000000000..b4f1c8047d --- /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; +}; + +var x_1 : u32; + +var x_7 : bool; + +var 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 0000000000..b433f10c1b --- /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 0000000000..5d03e49042 --- /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 0000000000..b80683d8bb --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_FromHeaderAndThen.spvasm.expected.msl @@ -0,0 +1,52 @@ +#include + +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 0000000000..d930c8722c --- /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 0000000000..cfe9e87746 --- /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; +}; + +var x_1 : u32; + +var x_7 : bool; + +var 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 0000000000..83d008f39f --- /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 0000000000..8d07dd476c --- /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 0000000000..10b28b7cbc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.msl @@ -0,0 +1,40 @@ +#include + +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 0000000000..6b004bc0cc --- /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 0000000000..b9e3c22e7e --- /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; +}; + +var x_1 : u32; + +var x_7 : bool; + +var 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 0000000000..670e9d2add --- /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 0000000000..a28f759e7b --- /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 0000000000..d1b9fef541 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.msl @@ -0,0 +1,47 @@ +#include + +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 0000000000..21516046b2 --- /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 0000000000..0cb6422ec9 --- /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; +}; + +var x_1 : u32; + +var x_7 : bool; + +var 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 0000000000..15e913b8eb --- /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 0000000000..56dbd1ccf5 --- /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 0000000000..148695cece --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.msl @@ -0,0 +1,43 @@ +#include + +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 0000000000..a265f16820 --- /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 0000000000..05b015a2a6 --- /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; +}; + +var x_1 : u32; + +var x_7 : bool; + +var 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 0000000000..300c05a9a4 --- /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 0000000000..5d1e440f86 --- /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 0000000000..e957103c42 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored.spvasm.expected.msl @@ -0,0 +1,31 @@ +#include + +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 0000000000..70ce29c227 --- /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 0000000000..da37a5e803 --- /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; +}; + +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 0000000000..8ec217a05f --- /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 0000000000..56a9a19711 --- /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 0000000000..d100dae32f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromLoopBodyAndContinuing.spvasm.expected.msl @@ -0,0 +1,44 @@ +#include + +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 0000000000..dcd5119a1c --- /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 0000000000..3d5749cf93 --- /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; +}; + +var x_1 : u32; + +var 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 0000000000..5e986de6fa --- /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 0000000000..7d340d661d --- /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 0000000000..c30c6186b0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_UseInPhiCountsAsUse.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..0fc23812a9 --- /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 0000000000..e1f35fcd45 --- /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; +}; + +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 0000000000..309eaa8851 --- /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 0000000000..7792c6cca3 --- /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 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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_CopyObject.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..54fcf1c79c --- /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 0000000000..a747f054cb --- /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; + +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 0000000000..b124eb3346 --- /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 0000000000..7792c6cca3 --- /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 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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Direct.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..54fcf1c79c --- /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 0000000000..a747f054cb --- /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; + +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 0000000000..caaea12842 --- /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 0000000000..7792c6cca3 --- /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 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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Image.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..54fcf1c79c --- /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 0000000000..a747f054cb --- /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; + +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 0000000000..c4561330dd --- /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 0000000000..7792c6cca3 --- /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 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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_Load.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..54fcf1c79c --- /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 0000000000..a747f054cb --- /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; + +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 0000000000..b75ff6f05e --- /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 0000000000..7792c6cca3 --- /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 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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserHandleTest_GetMemoryObjectDeclarationForHandle_Variable_SampledImage.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..54fcf1c79c --- /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 0000000000..a747f054cb --- /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; + +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 0000000000..d1da0aed13 --- /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 0000000000..7aadea3bef --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.hlsl @@ -0,0 +1,15 @@ +Texture2D 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 0000000000..9ff54daad7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserHandleTest_NeverGenerateConstDeclForHandle_UseVariableDirectly.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +using namespace metal; +void main_1(texture2d 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 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 0000000000..bf2703b6bf --- /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 0000000000..57dd5c448e --- /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; + +[[group(0), binding(1)]] var x_3 : sampler; + +fn main_1() { + var var_1 : vec4; + let x_22 : vec4 = textureSample(x_2, x_3, vec2(0.0, 0.0)); + let x_26 : vec4 = textureSample(x_2, x_3, vec2(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 0000000000..ce7f83a28a --- /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 0000000000..6909040aa1 --- /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 0000000000..ceb31986f3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..e39717203a --- /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 0000000000..159e6ecb76 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + first : u32; + rtarr : RTArr; +}; + +[[group(0), binding(0)]] var 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 0000000000..1f5160ddb0 --- /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 0000000000..6909040aa1 --- /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 0000000000..ceb31986f3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..e39717203a --- /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 0000000000..159e6ecb76 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + first : u32; + rtarr : RTArr; +}; + +[[group(0), binding(0)]] var 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 0000000000..101cfc920c --- /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 0000000000..a823f8a8c3 --- /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 0000000000..691c9bdd79 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..d3c10876bf --- /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 0000000000..5946ed3bf4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Array.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +var myvar : mat3x4; + +fn main_1() { + myvar[2u] = vec4(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 0000000000..76d2b9beca --- /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 0000000000..075acd5987 --- /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 0000000000..70ad8df0a4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..87f8e08b52 --- /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 0000000000..b299269259 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Compound_Matrix_Vector.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +var myvar : mat3x4; + +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 0000000000..e19550f96f --- /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 0000000000..724afae786 --- /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 0000000000..3cbe56bb56 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..d350ad9560 --- /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 0000000000..1aa32ffbb1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_DereferenceBase.spvasm.expected.wgsl @@ -0,0 +1,13 @@ +fn x_200(x_1 : ptr>) { + 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 0000000000..84d9ab4ab4 --- /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 0000000000..2706802ffb --- /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 0000000000..223e0209d9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_InferFunctionStorageClass.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..f910efa390 --- /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 0000000000..88fb9235e6 --- /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 = &(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 0000000000..2b301c61ab --- /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 0000000000..a823f8a8c3 --- /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 0000000000..691c9bdd79 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..d3c10876bf --- /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 0000000000..5946ed3bf4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Matrix.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +var myvar : mat3x4; + +fn main_1() { + myvar[2u] = vec4(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 0000000000..212defd6e0 --- /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 0000000000..3a71de3002 --- /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 0000000000..30fb4de620 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..a8679b9436 --- /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 0000000000..1020d48021 --- /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 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 0000000000..fc175380e6 --- /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 0000000000..a54dfa0ff4 --- /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 0000000000..7321f9bc73 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_DifferOnlyMemberName.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..8ba7712a69 --- /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 0000000000..6a3bcf1386 --- /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 myvar : S; + +var 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 0000000000..7cbc9d6898 --- /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 0000000000..01118257e7 --- /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 0000000000..02d7554069 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..424eb403b9 --- /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 0000000000..1613181e70 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_Struct_RuntimeArray.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : f32; + age : RTArr; +}; + +[[group(0), binding(0)]] var 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 0000000000..9f3ee6784c --- /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 0000000000..0bb697adf6 --- /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 0000000000..fb8ba9e195 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..403d538d9e --- /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 0000000000..9b3b2368a5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorNonConstIndex.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +var myvar : vec4; + +var x_10 : vec4; + +fn main_1() { + let x_11 : vec4 = 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 0000000000..fc280889b6 --- /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 0000000000..04495ad274 --- /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 0000000000..a72435998c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..16433fce89 --- /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 0000000000..e52b291afc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_AccessChain_VectorSwizzle.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +var myvar : vec4; + +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 0000000000..a1b14776a6 --- /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 0000000000..79794e4949 --- /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 0000000000..d71a2b99a0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..ce6e08a06e --- /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 0000000000..c4daeeafc0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_CopyMemory_Scalar_Function_To_Private.spvasm.expected.wgsl @@ -0,0 +1,12 @@ +var 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 0000000000..e5ba4a4876 --- /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 0000000000..82ac5275d8 --- /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 0000000000..09bfe9f619 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadBool.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..4b20fc227f --- /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 0000000000..98e051fad2 --- /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 0000000000..a681bf529a --- /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 0000000000..99af8f9515 --- /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 0000000000..0bebad7f17 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_LoadScalar.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..ffd75f03ca --- /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 0000000000..e83f8cddc7 --- /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 0000000000..2fb0b8b0ad --- /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 0000000000..4c3376e306 --- /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 0000000000..b4282dde6e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreBoolConst.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..ae01291777 --- /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 0000000000..bcc6cb96f3 --- /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 0000000000..51361a0dbd --- /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 0000000000..0e9290e946 --- /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 0000000000..c1d4c1f99f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreFloatConst.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..ca4e7a568c --- /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 0000000000..51a00a5adb --- /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 0000000000..fe9490843e --- /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 0000000000..1ecf6df433 --- /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 0000000000..bfcf069363 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreIntConst.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..ceb82a46ba --- /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 0000000000..7fa89f05e6 --- /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 0000000000..88540131b7 --- /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 0000000000..ce9f2c648e --- /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 0000000000..a11707510d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..5bfc4f8b56 --- /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 0000000000..adfb154255 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreToModuleScopeVar.spvasm.expected.wgsl @@ -0,0 +1,11 @@ +var 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 0000000000..3ccb3031e6 --- /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 0000000000..a481728cdf --- /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 0000000000..2d18ec6790 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_StoreUintConst.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..f359441334 --- /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 0000000000..0e7cc16eb5 --- /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 0000000000..ac52ab055c --- /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 0000000000..50151bce74 --- /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 0000000000..9d0f241698 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_EmitStatement_UseLoadedScalarTwice.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..742992c673 --- /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 0000000000..2df1056756 --- /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 0000000000..cf42eac01d --- /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 0000000000..da24ebee3f --- /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 0000000000..d0340a18a4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..6febe30778 --- /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 0000000000..36d715ba6a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_Cascaded.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : u32; + field1 : RTArr; +}; + +[[group(0), binding(0)]] var 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 0000000000..aceeb67bf0 --- /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 0000000000..1ad868f976 --- /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 0000000000..a4a55e9c3e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..476b04f0be --- /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 0000000000..8e3aa2e515 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : u32; + field1 : RTArr; +}; + +[[group(0), binding(0)]] var 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 0000000000..ca072e81d4 --- /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 0000000000..1ad868f976 --- /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 0000000000..a4a55e9c3e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..476b04f0be --- /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 0000000000..8e3aa2e515 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_ThroughAccessChain_NonCascaded_InBoundsAccessChain.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : u32; + field1 : RTArr; +}; + +[[group(0), binding(0)]] var 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 0000000000..d24fcf1e22 --- /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 0000000000..ef0855d437 --- /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 0000000000..a15bf99455 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..f6a41d8b41 --- /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 0000000000..2f2d4867ba --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserMemoryTest_RemapStorageBuffer_TypesAndVarDeclarations.spvasm.expected.wgsl @@ -0,0 +1,18 @@ +type RTArr = [[stride(4)]] array; + +[[block]] +struct S { + field0 : u32; + field1 : RTArr; +}; + +[[group(0), binding(0)]] var 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 0000000000..c3861cc5ca --- /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 0000000000..113536831c --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpNop.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..ca944f0cc9 --- /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 0000000000..471e2a6e06 --- /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 0000000000..6f70933bc8 --- /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 0000000000..1c333fc479 --- /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 0000000000..b8ebf26074 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Scalar.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..39169deb15 --- /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 0000000000..7f824c3c67 --- /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 0000000000..8be8717f17 --- /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 0000000000..f48d969e30 --- /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 0000000000..2c5087c312 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_BeforeFunction_Vector.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..34b50e986a --- /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 0000000000..16e44de669 --- /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 = vec2(false, false); + let x_11 : vec2 = vec2(0u, 0u); + let x_12 : vec2 = vec2(0, 0); + let x_13 : vec2 = vec2(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 0000000000..af00c2dec2 --- /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 0000000000..e2dc20cf09 --- /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 0000000000..c1cb8ea70f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Array.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..65a7f77dd6 --- /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 0000000000..1b7534194e --- /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 = array(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 0000000000..07161e1398 --- /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 0000000000..33b9a66aad --- /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 0000000000..39e9c109bc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Matrix.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..5d8aff4273 --- /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 0000000000..8a02cce9cd --- /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 = mat2x2(vec2(0.0, 0.0), vec2(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 0000000000..067ea4767f --- /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 0000000000..1c333fc479 --- /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 0000000000..b8ebf26074 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Scalar.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..39169deb15 --- /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 0000000000..7f824c3c67 --- /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 0000000000..798ef1f0cf --- /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 0000000000..1e627e2676 --- /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 0000000000..062b737a9f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Struct.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..6843c11a3c --- /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 0000000000..2ace22b335 --- /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 0000000000..031659c1da --- /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 0000000000..622822c4ea --- /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 0000000000..ed0c516180 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTestMiscInstruction_OpUndef_InFunction_Vector.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..18b0836b88 --- /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 0000000000..b77d651153 --- /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 = vec2(0u, 0u); + let x_12 : vec2 = vec2(0, 0); + let x_13 : vec2 = vec2(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 0000000000..bcbb92d603 --- /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 0000000000..8daeff32fa --- /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 0000000000..09866c15d0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type((30 & as_type(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 0000000000..d86103d267 --- /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 0000000000..28cdc31470 --- /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((30 & bitcast(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 0000000000..ca043cfadb --- /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 0000000000..ccbe5e6946 --- /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 0000000000..7185ce3b8e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = (30 & as_type(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 0000000000..974aae31cc --- /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 0000000000..8b6ccf6acf --- /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(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 0000000000..92a9458062 --- /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 0000000000..35fff8acc0 --- /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 0000000000..9b39fed8de --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = (10u & as_type(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 0000000000..0439ab75d7 --- /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 0000000000..ede5dddbbb --- /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(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 0000000000..3182a5ee3f --- /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 0000000000..267c570df9 --- /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 0000000000..7e6d49cf10 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = as_type((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 0000000000..dacfa9a742 --- /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 0000000000..ddd452adc8 --- /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((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 0000000000..0abe7349e4 --- /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 0000000000..35f97f33a8 --- /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 0000000000..5d6a8458c8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type((int2(30, 40) & as_type(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 0000000000..5e37605886 --- /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 0000000000..15cf3a75a7 --- /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 = bitcast>((vec2(30, 40) & bitcast>(vec2(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 0000000000..eea09d6dec --- /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 0000000000..6dcfce84c6 --- /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 0000000000..25561f049c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = as_type((uint2(10u, 20u) & as_type(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 0000000000..4fcbe33714 --- /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 0000000000..599291f2b1 --- /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 = bitcast>((vec2(10u, 20u) & bitcast>(vec2(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 0000000000..64b8ee31f9 --- /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 0000000000..6fd61f1295 --- /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 0000000000..4857feae05 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..c0acca2806 --- /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 0000000000..fa965604be --- /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 0000000000..4bd5b0ed36 --- /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 0000000000..069f035da2 --- /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 0000000000..9c2ddb4485 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..87fc4f08d0 --- /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 0000000000..e4fe605e07 --- /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 0000000000..45919905bf --- /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 0000000000..61c9c17dd1 --- /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 0000000000..35af63a645 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..bf1ec0d506 --- /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 0000000000..92d0c5b3b0 --- /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 = (vec2(10u, 20u) & vec2(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 0000000000..b88275e3eb --- /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 0000000000..777dfba62e --- /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 0000000000..244225b6ef --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseAnd_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..2956339e1d --- /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 0000000000..b67e7329a9 --- /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 = (vec2(30, 40) & vec2(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 0000000000..fdaa8447ff --- /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 0000000000..af5bd3d448 --- /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 0000000000..43972ab4eb --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type((30 | as_type(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 0000000000..6263cce736 --- /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 0000000000..c574be1c8c --- /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((30 | bitcast(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 0000000000..d23f276a33 --- /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 0000000000..fbb2d3dd91 --- /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 0000000000..161017d230 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = (30 | as_type(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 0000000000..3240ac4be5 --- /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 0000000000..4e8ebb1dc8 --- /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(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 0000000000..b35ccd0f30 --- /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 0000000000..fe7026fcad --- /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 0000000000..7303545c04 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = (10u | as_type(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 0000000000..f9b9023f05 --- /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 0000000000..8a4c1d2195 --- /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(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 0000000000..ab0c1cb89a --- /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 0000000000..dbc574562c --- /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 0000000000..ba5554ca0c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = as_type((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 0000000000..0e7eac2b02 --- /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 0000000000..b2913481e6 --- /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((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 0000000000..9ff8af47e3 --- /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 0000000000..0334e75fff --- /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 0000000000..d445f70652 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type((int2(30, 40) | as_type(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 0000000000..214b8c0b01 --- /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 0000000000..7e05596cba --- /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 = bitcast>((vec2(30, 40) | bitcast>(vec2(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 0000000000..6d0c1acea6 --- /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 0000000000..1e2f655ec0 --- /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 0000000000..3dee84ff8c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = as_type((uint2(10u, 20u) | as_type(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 0000000000..c56abb4d71 --- /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 0000000000..fe7e851ec0 --- /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 = bitcast>((vec2(10u, 20u) | bitcast>(vec2(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 0000000000..ebccc775c7 --- /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 0000000000..33a7f6a2b3 --- /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 0000000000..dd24d81cbd --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..e6efbf20a0 --- /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 0000000000..86bf584a22 --- /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 0000000000..c5eae25432 --- /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 0000000000..0f8b9c6589 --- /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 0000000000..09800fd37c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..2f91c36a1e --- /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 0000000000..481076238e --- /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 0000000000..c4177ff758 --- /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 0000000000..bd2b6f3537 --- /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 0000000000..d37cfabdc3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..729dcb4ad1 --- /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 0000000000..de8cdec37e --- /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 = (vec2(10u, 20u) | vec2(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 0000000000..bb224ab27f --- /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 0000000000..34cc261dbd --- /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 0000000000..0e2c805b4e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseOr_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..329413f09f --- /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 0000000000..02f76d17f6 --- /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 = (vec2(30, 40) | vec2(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 0000000000..87fe6d1b3d --- /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 0000000000..f084e8d01a --- /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 0000000000..2beff4c49d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type((30 ^ as_type(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 0000000000..9af7f7e04a --- /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 0000000000..5d4ebcbb86 --- /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((30 ^ bitcast(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 0000000000..f520a7046d --- /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 0000000000..ce0016b0aa --- /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 0000000000..1bd1ed6516 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = (30 ^ as_type(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 0000000000..93f031ae69 --- /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 0000000000..d728e0647c --- /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(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 0000000000..c31022ac33 --- /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 0000000000..96dfbcc564 --- /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 0000000000..e4a46335a9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = (10u ^ as_type(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 0000000000..13f74a4da5 --- /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 0000000000..9a7ed2cd76 --- /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(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 0000000000..b14860b25e --- /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 0000000000..49b03a7ecf --- /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 0000000000..5069e92335 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = as_type((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 0000000000..63b8a5157d --- /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 0000000000..13df5782f1 --- /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((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 0000000000..e33f645fea --- /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 0000000000..589ccb99c6 --- /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 0000000000..c17bc8a944 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type((int2(30, 40) ^ as_type(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 0000000000..cb261910ac --- /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 0000000000..25238d2f9a --- /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 = bitcast>((vec2(30, 40) ^ bitcast>(vec2(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 0000000000..a33d6cb8ce --- /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 0000000000..0bc9085b98 --- /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 0000000000..1b587bfae6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_MixedSignedness_SpvBinaryBitGeneralTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = as_type((uint2(10u, 20u) ^ as_type(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 0000000000..6abc053cc2 --- /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 0000000000..aedf8623c1 --- /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 = bitcast>((vec2(10u, 20u) ^ bitcast>(vec2(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 0000000000..39ec72d6f7 --- /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 0000000000..5cb2f7b784 --- /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 0000000000..7b580d93fe --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..ab87cf7fe4 --- /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 0000000000..7640633301 --- /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 0000000000..7409b70dd7 --- /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 0000000000..b0866038d7 --- /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 0000000000..9a6691b3fa --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..1de9101c93 --- /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 0000000000..bff8479153 --- /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 0000000000..ecafc473ab --- /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 0000000000..f318a1ffc6 --- /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 0000000000..3949abf621 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..bf9d7fb453 --- /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 0000000000..2f68b93a81 --- /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 = (vec2(10u, 20u) ^ vec2(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 0000000000..8f1348361f --- /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 0000000000..e1c2b26430 --- /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 0000000000..68ab203daa --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_BitwiseXor_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..7ff16f1bef --- /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 0000000000..fa65cd239e --- /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 = (vec2(30, 40) ^ vec2(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 0000000000..eab3405518 --- /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 0000000000..05d43e2ca0 --- /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 0000000000..fa5ff1bd88 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..3b9cb09bc7 --- /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 0000000000..f5ddf6372c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Array.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + var x_35 : array; + let x_1 : array = 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 0000000000..41a755adea --- /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 0000000000..89799a1c6b --- /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 0000000000..5ca2e35f9b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..ad6e65c417 --- /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 0000000000..8dc1f71f0b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + var x_35 : mat3x2; + let x_1 : mat3x2 = x_35; + let x_2 : vec2 = 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 0000000000..179fc5ea42 --- /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 0000000000..8a1c2e1a0f --- /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 0000000000..0030961a02 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..7fe8e86615 --- /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 0000000000..eceabfb8f4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Matrix_Vector.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + var x_35 : mat3x2; + let x_1 : mat3x2 = 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 0000000000..e67fef7930 --- /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 0000000000..2c66421a1a --- /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 0000000000..3aef3065d3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..5e02b6c73c --- /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 0000000000..39ef3eba36 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +struct S { + field0 : vec2; + 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 0000000000..ce37349f7b --- /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 0000000000..bc08b10801 --- /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 0000000000..848baf71ad --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.msl @@ -0,0 +1,28 @@ +#include + +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 0000000000..27b9be79e9 --- /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 0000000000..4279fe1f4b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Struct_Array_Matrix_Vector.spvasm.expected.wgsl @@ -0,0 +1,22 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +struct S_1 { + field0 : u32; + field1 : array, 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 0000000000..971f743be9 --- /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 0000000000..36759a18fb --- /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 0000000000..246c468d50 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..219e36a901 --- /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 0000000000..55863bbbdf --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeExtract_Vector.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + let x_1 : f32 = vec2(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 0000000000..38c0d5b9db --- /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 0000000000..19178b2f96 --- /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 0000000000..dcaff85af7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..2e5dcd505c --- /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 0000000000..5ce5820271 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Array.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + var x_35 : array; + let x_1 : array = x_35; + var x_2_1 : array = x_1; + x_2_1[3u] = 20u; + let x_2 : array = 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 0000000000..18a4662971 --- /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 0000000000..a70ffdd2f2 --- /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 0000000000..794de75808 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..5517818ec7 --- /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 0000000000..2816a96f25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + var x_35 : mat3x2; + let x_1 : mat3x2 = x_35; + var x_2_1 : mat3x2 = x_1; + x_2_1[2u] = vec2(50.0, 60.0); + let x_2 : mat3x2 = 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 0000000000..111b10bdb0 --- /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 0000000000..a70ffdd2f2 --- /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 0000000000..794de75808 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..5517818ec7 --- /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 0000000000..2816a96f25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Matrix_Vector.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + var x_35 : mat3x2; + let x_1 : mat3x2 = x_35; + var x_2_1 : mat3x2 = x_1; + x_2_1[2u] = vec2(50.0, 60.0); + let x_2 : mat3x2 = 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 0000000000..10d58e188d --- /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 0000000000..b7cd046e51 --- /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 0000000000..a09c526297 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.msl @@ -0,0 +1,23 @@ +#include + +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 0000000000..d81b00182a --- /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 0000000000..2af89236d8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct.spvasm.expected.wgsl @@ -0,0 +1,19 @@ +struct S { + field0 : vec2; + 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 0000000000..3225d09909 --- /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 0000000000..0382970eef --- /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 0000000000..3797dc8c03 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.msl @@ -0,0 +1,30 @@ +#include + +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 0000000000..662e895cfc --- /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 0000000000..0a251401a3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_Array_Matrix_Vector.spvasm.expected.wgsl @@ -0,0 +1,24 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +struct S_1 { + field0 : u32; + field1 : array, 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 0000000000..0dcc1e07ab --- /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 0000000000..e55fd971a8 --- /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 0000000000..2b3fd60c51 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Struct_DifferOnlyInMemberName.spvasm.expected.msl @@ -0,0 +1,29 @@ +#include + +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 0000000000..f611976716 --- /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 0000000000..ba2ae45483 --- /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 0000000000..4eb0b2cc06 --- /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 0000000000..7f31544657 --- /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 0000000000..8e3912a139 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..4a130b6a4f --- /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 0000000000..14d63041cd --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CompositeInsert_Vector.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + var x_1_1 : vec2 = vec2(50.0, 60.0); + x_1_1.y = 70.0; + let x_1 : vec2 = 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 0000000000..dd3711d730 --- /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 0000000000..7d783ca4ac --- /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 0000000000..8d4e43fde3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..6d4b90ffd5 --- /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 0000000000..05ed420bc8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Array.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + let x_1 : array = array(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 0000000000..02d7f3dd74 --- /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 0000000000..08b47433d1 --- /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 0000000000..099ab71853 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..a6199c2ea9 --- /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 0000000000..0bb8da50b1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Matrix.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + let x_1 : mat3x2 = mat3x2(vec2(50.0, 60.0), vec2(60.0, 50.0), vec2(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 0000000000..232467cf80 --- /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 0000000000..5fe220cc6a --- /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 0000000000..80d8ce6748 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..4a65d400b5 --- /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 0000000000..4b35253ec6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Struct.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + let x_1 : S = S(vec2(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 0000000000..a86377a0b3 --- /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 0000000000..d64f138ecb --- /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 0000000000..381608f677 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..16c2568adc --- /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 0000000000..57e2e22989 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Composite_Construct_Vector.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + let x_1 : vec2 = vec2(10u, 20u); + let x_2 : vec2 = vec2(30, 40); + let x_3 : vec2 = vec2(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 0000000000..b77bf99887 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Array.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..fa5d0a58b7 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..29e48c8b53 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..832c0586bd --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_ArrayStride_Valid.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +type Arr = [[stride(8)]] array; + +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 0000000000..f7c611aa1a --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Bool.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..e480e17e6b --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_F32.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..098d7065ed --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_I32.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..26bdfbf512 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Image_PretendVoid.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..7993591eeb --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_MatrixOverF32.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..cdd4c16711 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerFunction.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..5acd6eddbb --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerImage.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..e37d18e318 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerInput.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..5df1c30945 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerOutput.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..410668f5ea --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerPrivate.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..6a2e803816 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerStorageBuffer.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..1befa0ae83 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerToPointer.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..d6d8399e9b --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniform.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..436fe79418 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerUniformConstant.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..6eca0493fe --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_PointerWorkgroup.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..8739662b5c --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..f139cc395c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..2fa51ee026 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +type RTArr = array; + +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 0000000000..7254d4e149 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..35ec4e8b1f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..33ecaf5a73 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_RuntimeArray_ArrayStride_Valid.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +type RTArr = [[stride(64)]] array; + +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 0000000000..7afe986998 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_SampledImage_PretendVoid.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..603116984b --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Sampler_PretendVoid.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..a0f3e8e06b --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..5658b79e21 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructTwoMembers.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..9e865edd72 --- /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 0000000000..3ffa7a521f --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..f8e95d1cba --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithBlockDecoration.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..a7f1f27584 --- /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 0000000000..6a86cd0930 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..1d13c86dc5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_StructWithMemberDecorations.spvasm.expected.msl @@ -0,0 +1,18 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..67729f3cd1 --- /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; + field2 : mat2x2; +}; + +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 0000000000..f732eacc6b --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_U32.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..32ffb4d54f --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverF32.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..710952cb16 --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverI32.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..80c33b16bd --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_VecOverU32.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..159e98ea9c --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ConvertType_Void.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..7974f2a6fa --- /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 0000000000..0bc2907bba --- /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 0000000000..63dd04ced4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..bf3b29419e --- /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 0000000000..b4520cba6a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Pointer.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + var x_10 : u32; + let x_1 : ptr = &(x_10); + let x_2 : ptr = 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 0000000000..d47e3761b3 --- /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 0000000000..c46879a027 --- /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 0000000000..ba9d6915cc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..b547a71131 --- /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 0000000000..bb59772bb2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_CopyObject_Scalar.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +struct S { + field0 : vec2; + 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 0000000000..664bd69ecb --- /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 0000000000..f8a784abce --- /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 0000000000..305f1f96ec --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_CalleePrecedesCaller.spvasm.expected.msl @@ -0,0 +1,26 @@ +#include + +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 0000000000..0abd155520 --- /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 0000000000..2812801569 --- /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 0000000000..29a51e71a0 --- /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 0000000000..113536831c --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Fragment.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..ca944f0cc9 --- /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 0000000000..471e2a6e06 --- /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 0000000000..4038b2409d --- /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 0000000000..7d04ef1994 --- /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 0000000000..1de7f832f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..0114d7e6f1 --- /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 0000000000..05ff825f44 --- /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 0000000000..a10ab48f73 --- /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 0000000000..5166e1bc90 --- /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 0000000000..13e6b61321 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_GLCompute_LocalSize_Only.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..498c258aa5 --- /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 0000000000..605ba35256 --- /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 0000000000..5ffad5d3f4 --- /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 0000000000..c73a24323f --- /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 0000000000..818f216f66 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_LocalSize_And_WGSBuiltin_SpecConstant.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..d0987b2a50 --- /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 0000000000..32cb80544e --- /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 0000000000..9837add278 --- /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 0000000000..6d1d06451c --- /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 0000000000..c26e2c7b2b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_MultipleEntryPoints.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..74b91bfd36 --- /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 0000000000..20b0a60f0a --- /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 0000000000..946d2d1060 --- /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 0000000000..1993bce8dc --- /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 0000000000..31d71451d7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.msl @@ -0,0 +1,22 @@ +#include + +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 0000000000..8c45878c99 --- /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 0000000000..7f989e8d8e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_Vertex.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +var x_2 : vec4; + +fn main_1() { + return; +} + +struct main_out { + [[builtin(position)]] + x_2_1 : vec4; +}; + +[[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 0000000000..aea0060299 --- /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 0000000000..44502850e2 --- /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 0000000000..13e6b61321 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_Constant_Only.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..16f8d91455 --- /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 0000000000..7fba77305f --- /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 0000000000..839812e943 --- /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 0000000000..c73a24323f --- /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 0000000000..818f216f66 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSizeBuiltin_SpecConstant_Only.spvasm.expected.msl @@ -0,0 +1,15 @@ +#include + +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 0000000000..d0987b2a50 --- /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 0000000000..32cb80544e --- /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 0000000000..0c89e6bec6 --- /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 0000000000..e998d27039 --- /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 0000000000..020c4feac4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_Function_EntryPoint_WorkgroupSize_MixedConstantSpecConstant.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..6a4d2f7c5e --- /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 0000000000..7ee6f418f1 --- /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 0000000000..695dfcd695 --- /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 0000000000..fa3e50459a --- /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 0000000000..09cf906028 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_GenerateParamNames.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..d8023c916b --- /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 0000000000..59ec1443d3 --- /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 0000000000..373527422a --- /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 0000000000..8bb064f377 --- /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 0000000000..8c45f10111 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_MixedParamTypes.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..335fe4ada6 --- /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 0000000000..92df1dcdee --- /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 0000000000..86e41305f8 --- /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 0000000000..41e047785a --- /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 0000000000..e894cc3a9c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_NonVoidResultType.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..c059279b4b --- /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 0000000000..4a62673b20 --- /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 0000000000..cdb3e5740c --- /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 0000000000..b63a391a3b --- /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 0000000000..5d653d0dd8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitFunctions_VoidFunctionWithoutParams.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..c3318d1026 --- /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 0000000000..844ebc1393 --- /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 0000000000..8371af7874 --- /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 0000000000..1656622507 --- /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 0000000000..8f4f1c377a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_CallWithParams.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..031e2c0de6 --- /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 0000000000..5673d62cb1 --- /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 0000000000..1bcf149778 --- /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 0000000000..81982a4342 --- /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 0000000000..06d7dfc00a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParams.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..9ab6a52f78 --- /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 0000000000..bc149dfb5b --- /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 0000000000..b0f3c5d75e --- /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 0000000000..23a62a561a --- /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 0000000000..68968cb4da --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_ScalarCallNoParamsUsedTwice.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..5437902ad0 --- /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 0000000000..6fc6cb0030 --- /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 0000000000..86d5c995d1 --- /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 0000000000..6b5bd6afc9 --- /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 0000000000..a43084ee58 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_EmitStatement_VoidCallNoParams.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..340b927388 --- /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 0000000000..b01d65870a --- /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 0000000000..251c452af0 --- /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 0000000000..71f2e865a7 --- /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 0000000000..dc7c64f5c1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Emit_GenerateParamNames.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..057e45b2b2 --- /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 0000000000..336222e577 --- /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 0000000000..0803ef17f8 --- /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 0000000000..b662c2612f --- /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 0000000000..8c83ee23b8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Emit_MixedParamTypes.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..b6b979fee1 --- /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 0000000000..49b5c4fc79 --- /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 0000000000..457cce15ac --- /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 0000000000..89368e3087 --- /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 0000000000..7ad6db7b2b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Emit_NonVoidResultType.spvasm.expected.msl @@ -0,0 +1,16 @@ +#include + +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 0000000000..1ff2e3dc67 --- /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 0000000000..9eb339e9d3 --- /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 0000000000..82f9c8808c --- /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 0000000000..21d4c2f5f0 --- /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 0000000000..a84e7223ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Emit_VoidFunctionWithoutParams.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..916c0a411f --- /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 0000000000..0f1f8b7a58 --- /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 0000000000..1051c0ec42 --- /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 0000000000..5d58eb8967 --- /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 0000000000..7ab5c8b8dc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..501b8260a8 --- /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 0000000000..b8519a2470 --- /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 0000000000..89ef808d9b --- /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 0000000000..f48146052b --- /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 0000000000..f8fced1aad --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..cd830943fb --- /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 0000000000..9c3ae79d9e --- /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 = (vec2(50.0, 60.0) + vec2(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 0000000000..685f5756e6 --- /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 0000000000..4f6b1b00e4 --- /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 0000000000..3bb77d8e52 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..f7fb692b43 --- /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 0000000000..20ce1ed884 --- /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 0000000000..3a13a78d56 --- /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 0000000000..65ecc3b627 --- /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 0000000000..57a35d191e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..f86e637210 --- /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 0000000000..e4dcd9c9fb --- /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 = (vec2(50.0, 60.0) / vec2(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 0000000000..305f5daa24 --- /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 0000000000..b8f2184864 --- /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 0000000000..80a14d66d0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..1a418e8987 --- /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 0000000000..1d65720d9d --- /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 0000000000..190483823f --- /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 0000000000..0329458275 --- /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 0000000000..0a72f02b9e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..e061df7b4b --- /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 0000000000..83da3aeca6 --- /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 = (vec2(50.0, 60.0) * vec2(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 0000000000..58c15e3653 --- /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 0000000000..0fdafb9a4b --- /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 0000000000..ddbce6983a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..183a0c42c4 --- /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 0000000000..bd904bacf2 --- /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 0000000000..2a7b5df0e1 --- /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 0000000000..1e8a0eba59 --- /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 0000000000..9a9ff78e1b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FOrdEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..51400bec8e --- /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 0000000000..e118682eab --- /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 = (vec2(50.0, 60.0) == vec2(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 0000000000..350e651060 --- /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 0000000000..6b022772dd --- /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 0000000000..0b7e78b69b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..2af4d48e20 --- /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 0000000000..6474c9b8a5 --- /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 0000000000..cc18d59332 --- /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 0000000000..cc6388abc3 --- /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 0000000000..c8ea69dc5f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..f9e0a1cfd6 --- /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 0000000000..f33c0133ba --- /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 = (vec2(50.0, 60.0) >= vec2(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 0000000000..eac7fe78e5 --- /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 0000000000..b395733940 --- /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 0000000000..e2fec32b3f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..6add1d98ba --- /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 0000000000..93298982ac --- /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 0000000000..0115b21142 --- /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 0000000000..3d892012ba --- /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 0000000000..d1312d19e0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FOrdGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..f43f20b806 --- /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 0000000000..2ea7f10768 --- /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 = (vec2(50.0, 60.0) > vec2(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 0000000000..addac951cf --- /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 0000000000..439cdfbc9b --- /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 0000000000..2bf9e39472 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..3a0cf5656a --- /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 0000000000..bbc26573f8 --- /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 0000000000..52989cfbfb --- /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 0000000000..5a8aae498d --- /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 0000000000..a0d076d06b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..9f63d6a9f4 --- /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 0000000000..a3a429ba94 --- /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 = (vec2(50.0, 60.0) <= vec2(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 0000000000..c27638babe --- /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 0000000000..888c361e4d --- /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 0000000000..451287d4f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..9fb887e947 --- /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 0000000000..2f58a22c5d --- /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 0000000000..a02aee7e6b --- /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 0000000000..050e47fb3c --- /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 0000000000..1b992f8fc7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FOrdLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..6565ef26be --- /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 0000000000..2e3e3525e2 --- /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 = (vec2(50.0, 60.0) < vec2(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 0000000000..a65e42cf37 --- /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 0000000000..d682505023 --- /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 0000000000..60c4a54013 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..fca4100307 --- /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 0000000000..8d1c5e860f --- /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 0000000000..1d641a40e8 --- /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 0000000000..22d3e82e3a --- /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 0000000000..65c26d3a09 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FOrdNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..21f436ef9b --- /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 0000000000..077fbf6e89 --- /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 = (vec2(50.0, 60.0) != vec2(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 0000000000..3ca4acad1d --- /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 0000000000..1c931e7d4e --- /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 0000000000..b4462f4764 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..a44c20a811 --- /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 0000000000..271d304982 --- /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 0000000000..1240f5842a --- /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 0000000000..becf790805 --- /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 0000000000..8c46829518 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FRem_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..573b966a89 --- /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 0000000000..651cb6f759 --- /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 = (vec2(50.0, 60.0) % vec2(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 0000000000..ac2c8213b1 --- /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 0000000000..1ea05079f2 --- /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 0000000000..b8bf490309 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..bbaa3eb523 --- /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 0000000000..35c05a3df1 --- /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 0000000000..267a16a5d1 --- /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 0000000000..01938b0a70 --- /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 0000000000..aba88c4084 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_FSub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..fa02a9ecfb --- /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 0000000000..7c15effcfc --- /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 = (vec2(50.0, 60.0) - vec2(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 0000000000..d80e15ca88 --- /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 0000000000..0e53fc1f69 --- /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 0000000000..8488e7a9de --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Scalar.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..edc4086414 --- /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 0000000000..13bb1dbb8b --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..cca05b5c13 --- /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 0000000000..8db1479296 --- /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 0000000000..0bc76fb54d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Degrees_Vector.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..8ed2398c3a --- /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 0000000000..2b55baac4d --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec3 = (vec3(60.0, 70.0, 50.0) * vec3(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 0000000000..f6991fdbdc --- /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 0000000000..2c7cb1cf5d --- /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 0000000000..40b47a976b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Scalar.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +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 0000000000..7ee5ac8c48 --- /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 0000000000..7df390334d --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..9763005cac --- /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 0000000000..33ab00f1fe --- /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 0000000000..a689cf852b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_FaceForward_Vector.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +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 0000000000..a4bb534ddf --- /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 0000000000..24e2556bb3 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_99 : vec2 = (v2f1 + v2f1); + let x_1 : vec2 = 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 0000000000..634e506613 --- /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 0000000000..5ac4b2d01b --- /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 0000000000..42cf7f6947 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Scalar.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..ff034415b3 --- /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 0000000000..babef61fa6 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..5a2c04851f --- /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 0000000000..63ead059f2 --- /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 0000000000..c78ed47466 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Radians_Vector.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..5b37b27450 --- /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 0000000000..2b00f7454c --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec3 = (vec3(60.0, 70.0, 50.0) * vec3(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 0000000000..c2ae3f3e79 --- /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 0000000000..4508a0621a --- /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 0000000000..b6df30594a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Scalar.spvasm.expected.msl @@ -0,0 +1,37 @@ +#include + +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 0000000000..75df3239b2 --- /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 0000000000..d49b8dfe3d --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..9ab2829d52 --- /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 0000000000..520cb20fea --- /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 0000000000..f2ea7f0426 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Reflect_Vector.spvasm.expected.msl @@ -0,0 +1,37 @@ +#include + +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 0000000000..d245c34d73 --- /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 0000000000..d7448e8619 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_98 : vec2 = (v2f1 + v2f1); + let x_99 : vec2 = (v2f2 + v2f2); + let x_1 : vec2 = 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 0000000000..db593e2b73 --- /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 0000000000..bd33258a0d --- /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 0000000000..158f79e1d7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Scalar.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..298630d535 --- /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 0000000000..8cd2c79431 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : f32 = refract(vec2(f1, 0.0), vec2(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 0000000000..b15613618e --- /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 0000000000..edf4bcd86d --- /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 0000000000..9df2059b54 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_GlslStd450_Refract_Vector.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..710ed48f54 --- /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 0000000000..152b4f58a1 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..e069bf30a4 --- /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 0000000000..a70664c991 --- /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 0000000000..6bd4685512 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type((30 + as_type(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 0000000000..39bd4869a3 --- /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 0000000000..089a1912d5 --- /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((30 + bitcast(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 0000000000..3968b70000 --- /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 0000000000..2bb3392890 --- /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 0000000000..53b8e7779b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = (30 + as_type(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 0000000000..3bc7079dba --- /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 0000000000..b44f1d56f6 --- /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(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 0000000000..8cd695f0a8 --- /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 0000000000..f2e60bfe59 --- /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 0000000000..a467ebf52c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = (10u + as_type(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 0000000000..89a66db83f --- /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 0000000000..b0965f7102 --- /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(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 0000000000..d7f150782d --- /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 0000000000..76ee2dbe4d --- /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 0000000000..a01c1f2a54 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = as_type((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 0000000000..6f4b33490a --- /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 0000000000..2737419be7 --- /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((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 0000000000..62aea1bef4 --- /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 0000000000..d04ca14060 --- /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 0000000000..057f374590 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type((int2(30, 40) + as_type(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 0000000000..c74351cc36 --- /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 0000000000..8a2483bd6b --- /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 = bitcast>((vec2(30, 40) + bitcast>(vec2(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 0000000000..a2ef8438d6 --- /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 0000000000..62873fd83f --- /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 0000000000..904d114cb9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = as_type((uint2(10u, 20u) + as_type(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 0000000000..d0b6e63761 --- /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 0000000000..915a5d2b00 --- /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 = bitcast>((vec2(10u, 20u) + bitcast>(vec2(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 0000000000..8f2a1b452f --- /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 0000000000..ae95ad5e09 --- /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 0000000000..dbe5779e9d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..14b7586c96 --- /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 0000000000..80e3cd9c1d --- /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 0000000000..58e7dbbd0c --- /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 0000000000..634063cf95 --- /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 0000000000..7a5d3301cc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..fc75ca467c --- /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 0000000000..a51fe4e9e0 --- /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 0000000000..924790178d --- /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 0000000000..6a9156d7b1 --- /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 0000000000..849afc5c77 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..9d95c08037 --- /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 0000000000..03de63f623 --- /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 = (vec2(10u, 20u) + vec2(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 0000000000..b7167401e2 --- /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 0000000000..1dd9722956 --- /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 0000000000..409fe524d6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IAdd_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..edd0729904 --- /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 0000000000..67bf68e76e --- /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 = (vec2(30, 40) + vec2(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 0000000000..78dcfa17b8 --- /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 0000000000..c5abd6e7f5 --- /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 0000000000..ad4dbce47e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..d5aec7da2e --- /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 0000000000..0eebca7a1d --- /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 0000000000..d3a3744a58 --- /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 0000000000..4bb04e28b7 --- /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 0000000000..f441a6cd2a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..282f307a89 --- /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 0000000000..3c86e10978 --- /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 0000000000..523a8908d3 --- /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 0000000000..1682c95084 --- /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 0000000000..7942900fab --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (10u == as_type(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 0000000000..b024031d2a --- /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 0000000000..66308624e2 --- /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(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 0000000000..ceefe2ef0d --- /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 0000000000..6f61155986 --- /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 0000000000..76aecf0fc4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (40 == as_type(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 0000000000..c924384d0c --- /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 0000000000..24d16f1f9a --- /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(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 0000000000..5a62dd4a0b --- /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 0000000000..8cb8a41b1e --- /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 0000000000..33ef672e2d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..207a0927ea --- /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 0000000000..896c40d5b5 --- /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 = (vec2(10u, 20u) == vec2(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 0000000000..02e447ea47 --- /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 0000000000..cb311653ee --- /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 0000000000..f137971a9e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..794aee3aa2 --- /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 0000000000..9678081ba5 --- /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 = (vec2(30, 40) == vec2(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 0000000000..46635df637 --- /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 0000000000..13437e5445 --- /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 0000000000..16997fae7d --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type((30 * as_type(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 0000000000..c03046e823 --- /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 0000000000..fdae7726f0 --- /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((30 * bitcast(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 0000000000..1b706c3a3f --- /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 0000000000..dab216869f --- /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 0000000000..e44de6a043 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = (30 * as_type(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 0000000000..9805f0255e --- /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 0000000000..ed7343b530 --- /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(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 0000000000..a4f7a92735 --- /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 0000000000..19b49849ce --- /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 0000000000..7bb6fb50d1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = (10u * as_type(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 0000000000..cf4bf78891 --- /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 0000000000..f055e20040 --- /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(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 0000000000..8e86c6c704 --- /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 0000000000..685e5ecbaa --- /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 0000000000..0c6329934f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = as_type((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 0000000000..a07c1b8988 --- /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 0000000000..70f4e237de --- /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((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 0000000000..f90207cfa1 --- /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 0000000000..c2db694ce1 --- /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 0000000000..004e320d87 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type((int2(30, 40) * as_type(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 0000000000..446dd1b4f3 --- /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 0000000000..163b2092d9 --- /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 = bitcast>((vec2(30, 40) * bitcast>(vec2(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 0000000000..8be7d4f9a2 --- /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 0000000000..11199ec2ad --- /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 0000000000..d8943b7766 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IMul_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = as_type((uint2(10u, 20u) * as_type(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 0000000000..f3b4b7932e --- /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 0000000000..3ff7bf1d1a --- /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 = bitcast>((vec2(10u, 20u) * bitcast>(vec2(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 0000000000..3b3c8fef25 --- /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 0000000000..32fd0390f2 --- /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 0000000000..ff512b94a5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..4cbc23ff1a --- /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 0000000000..db992a1352 --- /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 0000000000..67bcda64a1 --- /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 0000000000..8b7ddea2fb --- /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 0000000000..97abd51418 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..054491b8a3 --- /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 0000000000..36055498c2 --- /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 0000000000..a2ba7b53fb --- /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 0000000000..e903d3196a --- /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 0000000000..031e2c7310 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..b149d90249 --- /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 0000000000..302f1bd2c9 --- /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 = (vec2(10u, 20u) * vec2(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 0000000000..7af6f69d25 --- /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 0000000000..a902abb0ac --- /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 0000000000..c0ed5fa90f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_IMul_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..1f8967fdfc --- /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 0000000000..463a31dd59 --- /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 = (vec2(30, 40) * vec2(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 0000000000..3d09524141 --- /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 0000000000..9a1ea1dc9e --- /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 0000000000..27fa6176c6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..70802848b9 --- /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 0000000000..289af884fc --- /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 0000000000..2a7c4bc2af --- /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 0000000000..d5e6e896f6 --- /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 0000000000..6c5304dc23 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..136ca1e3f4 --- /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 0000000000..5f798f4336 --- /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 0000000000..dbd2ac22ab --- /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 0000000000..cefd02dcf8 --- /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 0000000000..aaebd00eec --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (10u != as_type(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 0000000000..0ac55aea2a --- /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 0000000000..b48ae512f1 --- /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(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 0000000000..bbe6493354 --- /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 0000000000..95bd50f2a2 --- /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 0000000000..e2bd1fd68a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (40 != as_type(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 0000000000..e77eeb1207 --- /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 0000000000..0426f71a14 --- /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(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 0000000000..51c37e7ffa --- /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 0000000000..ea71e083e3 --- /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 0000000000..4a0b714409 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..f5542c56fc --- /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 0000000000..71bef4adb5 --- /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 = (vec2(10u, 20u) != vec2(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 0000000000..d563a37c0c --- /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 0000000000..c14b6a397e --- /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 0000000000..5d3fdd975b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_INotEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..32b136005c --- /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 0000000000..507065d906 --- /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 = (vec2(30, 40) != vec2(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 0000000000..c8afa21f9c --- /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 0000000000..9f28ae3263 --- /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 0000000000..d0a0b1ae40 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type((30 - as_type(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 0000000000..5b1b6d6dbc --- /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 0000000000..114a500d3a --- /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((30 - bitcast(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 0000000000..e502abd9c6 --- /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 0000000000..9f0aea8ad4 --- /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 0000000000..2e450fed48 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = (30 - as_type(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 0000000000..a1d2f9c6af --- /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 0000000000..2ba41046c3 --- /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(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 0000000000..40d166bc79 --- /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 0000000000..1fb98d0fd6 --- /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 0000000000..4783009991 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = (10u - as_type(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 0000000000..e696da659c --- /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 0000000000..a5696bd607 --- /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(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 0000000000..caa5466a2d --- /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 0000000000..d52f28d5b0 --- /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 0000000000..d8d6962d1a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = as_type((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 0000000000..4376189f4b --- /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 0000000000..5f47fc6385 --- /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((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 0000000000..c5599b3329 --- /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 0000000000..dc9ae9741d --- /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 0000000000..7caef80417 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type((int2(30, 40) - as_type(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 0000000000..b28b1128fa --- /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 0000000000..4552c14bcf --- /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 = bitcast>((vec2(30, 40) - bitcast>(vec2(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 0000000000..04dd44bce2 --- /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 0000000000..055f410aee --- /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 0000000000..e4dd9d06ab --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ISub_MixedSignedness_SpvBinaryArithGeneralTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = as_type((uint2(10u, 20u) - as_type(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 0000000000..0bfbe9b988 --- /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 0000000000..2aad01ee6c --- /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 = bitcast>((vec2(10u, 20u) - bitcast>(vec2(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 0000000000..1c07ef0d79 --- /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 0000000000..cdb420b0de --- /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 0000000000..1232f61c39 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..f625348c47 --- /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 0000000000..d9230b5235 --- /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 0000000000..57fab25ee0 --- /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 0000000000..80fc1e3c53 --- /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 0000000000..f75aa31450 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..63364b9769 --- /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 0000000000..d4c522a644 --- /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 0000000000..6ed7f0a559 --- /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 0000000000..5ca61a80e1 --- /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 0000000000..dba660b0d9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..f9c645d0d5 --- /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 0000000000..2078358215 --- /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 = (vec2(10u, 20u) - vec2(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 0000000000..9a9ddbf57c --- /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 0000000000..2e9894b1af --- /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 0000000000..525e924556 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ISub_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..bad9c624b7 --- /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 0000000000..0194db89c2 --- /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 = (vec2(30, 40) - vec2(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 0000000000..8072013352 --- /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 0000000000..7d04ef1994 --- /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 0000000000..1de7f832f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_GLSL450MemoryModel.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..0114d7e6f1 --- /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 0000000000..05ff825f44 --- /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 0000000000..ed56608aab --- /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 0000000000..7d04ef1994 --- /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 0000000000..1de7f832f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_SimpleMemoryModel.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..0114d7e6f1 --- /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 0000000000..05ff825f44 --- /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 0000000000..0da7cd2c3c --- /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 0000000000..7d04ef1994 --- /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 0000000000..1de7f832f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Impl_GenericVulkanShader_VulkanMemoryModel.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..0114d7e6f1 --- /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 0000000000..05ff825f44 --- /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 0000000000..faba8e34f6 --- /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 0000000000..7d04ef1994 --- /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 0000000000..1de7f832f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_InvalidId.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..0114d7e6f1 --- /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 0000000000..05ff825f44 --- /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 0000000000..880e9d2c02 --- /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 0000000000..7d04ef1994 --- /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 0000000000..1de7f832f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_NoOpLine.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..0114d7e6f1 --- /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 0000000000..05ff825f44 --- /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 0000000000..8735284c20 --- /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 0000000000..7d04ef1994 --- /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 0000000000..1de7f832f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Impl_Source_WithOpLine_WithOpNoLine.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..0114d7e6f1 --- /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 0000000000..05ff825f44 --- /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 0000000000..3aa8fc8bb6 --- /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 0000000000..6ff4e0d884 --- /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 0000000000..3a9a17c33a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..7e7b5fa570 --- /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 0000000000..31d0cdacf3 --- /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 0000000000..e66a4a58fa --- /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 0000000000..d4c3151aa6 --- /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 0000000000..a742917553 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_LogicalAnd_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..d0f1211cdd --- /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 0000000000..e433e28b8a --- /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 = (vec2(true, false) & vec2(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 0000000000..e288aab39e --- /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 0000000000..8cdd1c10b2 --- /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 0000000000..6cbe165dd2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..47fb878fde --- /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 0000000000..d910851e22 --- /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 0000000000..15560ce730 --- /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 0000000000..f5ac81acc8 --- /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 0000000000..83ad92b9e1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_LogicalEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..ad3fd3541f --- /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 0000000000..ab3500cbf5 --- /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 = (vec2(true, false) == vec2(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 0000000000..9e35b9aaf3 --- /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 0000000000..44272bb6d6 --- /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 0000000000..ddeb2de65b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..f322a1d78b --- /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 0000000000..9391abd0ff --- /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 0000000000..3a9196e905 --- /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 0000000000..7a639b2f96 --- /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 0000000000..e0133cf290 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_LogicalNotEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..78ae80cf23 --- /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 0000000000..6919af327a --- /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 = (vec2(true, false) != vec2(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 0000000000..0ac3551131 --- /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 0000000000..839b7e6a4e --- /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 0000000000..7fe4c06ac1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..fa39d05e59 --- /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 0000000000..08ce435513 --- /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 0000000000..ec408f4692 --- /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 0000000000..a46d24d69a --- /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 0000000000..3bb31d1e46 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_LogicalOr_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..8df242a057 --- /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 0000000000..3a972a85f9 --- /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 = (vec2(true, false) | vec2(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 0000000000..526d0ef0ad --- /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 0000000000..e04c522046 --- /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 0000000000..08de93caa8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Scalar.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..2f01ae1531 --- /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 0000000000..0495eff129 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = 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 0000000000..05605136bb --- /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 0000000000..b66ee0b806 --- /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 0000000000..1b791c9310 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector2.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..ac4aa8d648 --- /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 0000000000..2ab7993c47 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec2 = 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 0000000000..a817488716 --- /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 0000000000..7da5a59cd4 --- /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 0000000000..a75733da88 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector3.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..7381c81ff1 --- /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 0000000000..8a15992410 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec3 = 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 0000000000..a19e8e7db9 --- /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 0000000000..b613febe78 --- /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 0000000000..818b1f8dd0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_Normalize_Vector4.spvasm.expected.msl @@ -0,0 +1,35 @@ +#include + +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 0000000000..6c7867ad5e --- /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 0000000000..82185ba10e --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : vec4 = 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 0000000000..00b0f4a432 --- /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 0000000000..88f882aba1 --- /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 0000000000..5f2b521151 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SAbs.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +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(abs(as_type(u1))); + uint2 const x_2 = as_type(abs(as_type(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 0000000000..470c7dfe23 --- /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 0000000000..491fb354b7 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : u32 = bitcast(abs(bitcast(u1))); + let x_2 : vec2 = bitcast>(abs(bitcast>(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 0000000000..823c5831be --- /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 0000000000..6f41bb3f13 --- /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 0000000000..e4b7ad4027 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SClamp.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +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(clamp(as_type(u1), i2, as_type(u3))); + uint2 const x_2 = as_type(clamp(as_type(v2u1), v2i2, as_type(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 0000000000..b3fde4f18b --- /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 0000000000..e09d7df995 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : u32 = bitcast(clamp(bitcast(u1), i2, bitcast(u3))); + let x_2 : vec2 = bitcast>(clamp(bitcast>(v2u1), v2i2, bitcast>(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 0000000000..3bc4ce64d6 --- /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 0000000000..93cc10bc23 --- /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 0000000000..d57ffef62c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMax.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +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(max(as_type(u1), as_type(u2))); + uint2 const x_2 = as_type(max(as_type(v2u1), as_type(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 0000000000..0d65721013 --- /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 0000000000..645cbebd3a --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : u32 = bitcast(max(bitcast(u1), bitcast(u2))); + let x_2 : vec2 = bitcast>(max(bitcast>(v2u1), bitcast>(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 0000000000..a9bd9f9568 --- /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 0000000000..bfd2e77ecb --- /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 0000000000..788552ec95 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_SMin.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +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(min(as_type(u1), as_type(u2))); + uint2 const x_2 = as_type(min(as_type(v2u1), as_type(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 0000000000..b74dc36a6c --- /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 0000000000..2ef32a43f5 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : u32 = bitcast(min(bitcast(u1), bitcast(u2))); + let x_2 : vec2 = bitcast>(min(bitcast>(v2u1), bitcast>(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 0000000000..a5eebdfba1 --- /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 0000000000..3e0abef26c --- /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 0000000000..f96a5c4344 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UClamp.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +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(clamp(as_type(i1), u2, as_type(i3))); + int2 const x_2 = as_type(clamp(as_type(v2i1), v2u2, as_type(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 0000000000..523237de93 --- /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 0000000000..a4a8e84950 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : i32 = bitcast(clamp(bitcast(i1), u2, bitcast(i3))); + let x_2 : vec2 = bitcast>(clamp(bitcast>(v2i1), v2u2, bitcast>(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 0000000000..f8b6b28db5 --- /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 0000000000..53c460a448 --- /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 0000000000..63af415d6f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMax.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +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(max(as_type(i1), as_type(i2))); + int2 const x_2 = as_type(max(as_type(v2i1), as_type(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 0000000000..8188c0f110 --- /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 0000000000..dfc2521409 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : i32 = bitcast(max(bitcast(i1), bitcast(i2))); + let x_2 : vec2 = bitcast>(max(bitcast>(v2i1), bitcast>(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 0000000000..cf942f6105 --- /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 0000000000..f01d5945b6 --- /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 0000000000..f0705ea0a7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_RectifyOperandsAndResult_UMin.spvasm.expected.msl @@ -0,0 +1,36 @@ +#include + +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(min(as_type(i1), as_type(i2))); + int2 const x_2 = as_type(min(as_type(v2i1), as_type(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 0000000000..98a38f6b07 --- /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 0000000000..2f6410a2e9 --- /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 = vec2(10u, 20u); + let v2u2 : vec2 = vec2(20u, 10u); + let v2u3 : vec2 = vec2(15u, 15u); + let v2i1 : vec2 = vec2(30, 40); + let v2i2 : vec2 = vec2(40, 30); + let v2i3 : vec2 = vec2(35, 35); + let v2f1 : vec2 = vec2(50.0, 60.0); + let v2f2 : vec2 = vec2(60.0, 50.0); + let v2f3 : vec2 = vec2(70.0, 70.0); + let v3f1 : vec3 = vec3(50.0, 60.0, 70.0); + let v3f2 : vec3 = vec3(60.0, 70.0, 50.0); + let v4f1 : vec4 = vec4(50.0, 50.0, 50.0, 50.0); + let v4f2 : vec4 = v4f1; + let x_1 : i32 = bitcast(min(bitcast(i1), bitcast(i2))); + let x_2 : vec2 = bitcast>(min(bitcast>(v2i1), bitcast>(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 0000000000..0a1f523892 --- /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 0000000000..defa908422 --- /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 0000000000..e5ac158004 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = (30 / as_type(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 0000000000..b13347e851 --- /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 0000000000..58c4800e55 --- /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(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 0000000000..cc28604878 --- /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 0000000000..63478a3ea3 --- /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 0000000000..ec582b599a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = (as_type(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 0000000000..40e86f4bc4 --- /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 0000000000..b516923bd2 --- /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(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 0000000000..0ded8d423f --- /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 0000000000..d2f1861879 --- /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 0000000000..a4cca6a7f9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = (as_type(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 0000000000..0cb0fff915 --- /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 0000000000..a83a6d2a71 --- /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 = (bitcast>(vec2(10u, 20u)) / vec2(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 0000000000..1252c4be58 --- /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 0000000000..7979a9b8e2 --- /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 0000000000..451cfadd77 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = (int2(30, 40) / as_type(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 0000000000..412e08b86a --- /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 0000000000..55f712906f --- /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 = (vec2(30, 40) / bitcast>(vec2(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 0000000000..ae6e5fea73 --- /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 0000000000..5179e09b64 --- /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 0000000000..daabff4eba --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..9c9ba2b6f9 --- /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 0000000000..b3f732fe56 --- /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 0000000000..c29f46f2c2 --- /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 0000000000..2fc0a3290e --- /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 0000000000..8aa7b14a41 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..42b241b1c0 --- /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 0000000000..04fc1d23bb --- /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 = (vec2(30, 40) / vec2(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 0000000000..4f4817551e --- /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 0000000000..8b818ec35d --- /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 0000000000..b48d94ab35 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..4c3dbf8a24 --- /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 0000000000..d9c02fd78e --- /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 0000000000..600ce00b15 --- /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 0000000000..ada89cfea8 --- /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 0000000000..d35ed705b2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (as_type(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 0000000000..4ead06b73e --- /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 0000000000..51fa4f9f21 --- /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(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 0000000000..fd9e1b6ede --- /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 0000000000..9d6c8de586 --- /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 0000000000..b59806755a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (30 >= as_type(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 0000000000..bcf5de9162 --- /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 0000000000..804ed03a35 --- /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(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 0000000000..4f21ba77e3 --- /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 0000000000..e32aea753b --- /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 0000000000..ec751ec6af --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..9a475a3f58 --- /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 0000000000..dafbd49524 --- /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 = (vec2(30, 40) >= vec2(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 0000000000..9f0fe82d85 --- /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 0000000000..7666b7d135 --- /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 0000000000..932cbe80ae --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (as_type(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 0000000000..fd8bab85bf --- /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 0000000000..0352cfcb23 --- /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 = (bitcast>(vec2(10u, 20u)) >= vec2(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 0000000000..5dd2483dc8 --- /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 0000000000..f74a2cc77c --- /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 0000000000..17b0609af9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (int2(30, 40) >= as_type(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 0000000000..577be19baf --- /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 0000000000..02da6b0274 --- /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 = (vec2(30, 40) >= bitcast>(vec2(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 0000000000..f12d052646 --- /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 0000000000..5605d58bdd --- /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 0000000000..162e06b4da --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..bf38d33f70 --- /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 0000000000..895ed770c1 --- /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 0000000000..d9718bb49d --- /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 0000000000..e6c107ba36 --- /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 0000000000..d888be9dad --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (as_type(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 0000000000..1e38c38431 --- /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 0000000000..a7094f20f2 --- /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(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 0000000000..197a6541ea --- /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 0000000000..cb82baf173 --- /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 0000000000..be5e68b826 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (30 > as_type(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 0000000000..b14b89306d --- /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 0000000000..105fab9834 --- /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(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 0000000000..15eba45f0c --- /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 0000000000..87fae0edea --- /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 0000000000..cf4ad4a010 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..5dfcaf9b1f --- /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 0000000000..9f59d59595 --- /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 = (vec2(30, 40) > vec2(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 0000000000..11d301f565 --- /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 0000000000..8650924d7c --- /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 0000000000..f30a5d5707 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (as_type(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 0000000000..7a2e86e6bf --- /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 0000000000..2680fb4db9 --- /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 = (bitcast>(vec2(10u, 20u)) > vec2(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 0000000000..10ecb3ca73 --- /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 0000000000..6fedeac2e0 --- /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 0000000000..532d559018 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (int2(30, 40) > as_type(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 0000000000..db2ed4fbc5 --- /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 0000000000..2ad66c57bb --- /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 = (vec2(30, 40) > bitcast>(vec2(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 0000000000..739fae9ae8 --- /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 0000000000..bcfbc55a11 --- /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 0000000000..b5e0e61f15 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..182d1edd6a --- /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 0000000000..e58399669e --- /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 0000000000..1887106662 --- /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 0000000000..3f403d756a --- /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 0000000000..a845fcba2f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (as_type(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 0000000000..4f210d2298 --- /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 0000000000..e6eea97893 --- /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(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 0000000000..8e2a38bfe1 --- /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 0000000000..8494aef521 --- /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 0000000000..76d54353a2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (30 <= as_type(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 0000000000..bda3489ff9 --- /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 0000000000..6aa2915536 --- /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(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 0000000000..3d37102f5f --- /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 0000000000..5b5e70c75a --- /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 0000000000..196682980e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..507bff38f8 --- /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 0000000000..fbd80c79d6 --- /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 = (vec2(30, 40) <= vec2(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 0000000000..d41cb8ddcc --- /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 0000000000..6d9da8aad5 --- /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 0000000000..1b10334487 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (as_type(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 0000000000..4138a0fdbf --- /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 0000000000..5593a3b0bc --- /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 = (bitcast>(vec2(10u, 20u)) <= vec2(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 0000000000..b7f03947af --- /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 0000000000..ea43b6b5ce --- /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 0000000000..0af243203f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SLessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (int2(30, 40) <= as_type(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 0000000000..9bcc136bf1 --- /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 0000000000..0e1cb7fd7a --- /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 = (vec2(30, 40) <= bitcast>(vec2(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 0000000000..d35bc5a63d --- /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 0000000000..ead1e5e4d6 --- /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 0000000000..7e80f5deb9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..278b5c551a --- /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 0000000000..11b06423d1 --- /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 0000000000..0fe3cf6baa --- /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 0000000000..45b3aeb79b --- /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 0000000000..b16d09f90e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (as_type(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 0000000000..781f412db3 --- /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 0000000000..a9497dde1e --- /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(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 0000000000..8fbc298649 --- /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 0000000000..a040e74a15 --- /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 0000000000..1042dba6dd --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (30 < as_type(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 0000000000..d388618548 --- /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 0000000000..f078b970b1 --- /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(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 0000000000..65a0bb8ea1 --- /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 0000000000..12d6f0fa64 --- /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 0000000000..e6def402e5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..efb9643080 --- /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 0000000000..3664a2fba2 --- /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 = (vec2(30, 40) < vec2(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 0000000000..3268fd9ef8 --- /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 0000000000..a8908da542 --- /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 0000000000..ec554e9635 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (as_type(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 0000000000..81635312ae --- /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 0000000000..118474d439 --- /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 = (bitcast>(vec2(10u, 20u)) < vec2(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 0000000000..6a8dcf52d3 --- /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 0000000000..cbc92454bc --- /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 0000000000..cc17d4affd --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SLessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (int2(30, 40) < as_type(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 0000000000..6c1b6199c9 --- /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 0000000000..a26f77d7ea --- /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 = (vec2(30, 40) < bitcast>(vec2(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 0000000000..21f4aed082 --- /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 0000000000..d7480051a1 --- /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 0000000000..55517d6bdd --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = (30 % as_type(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 0000000000..bd60d091b8 --- /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 0000000000..8f02084fd9 --- /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(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 0000000000..7eb5ec9e01 --- /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 0000000000..63e176ffef --- /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 0000000000..c3a9181b91 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = (as_type(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 0000000000..e86a863a7e --- /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 0000000000..b34b87b52d --- /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(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 0000000000..0f6693c90d --- /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 0000000000..5883bd91ea --- /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 0000000000..75cd027ef3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = (as_type(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 0000000000..288a9ba1cc --- /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 0000000000..d1bd49d619 --- /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 = (bitcast>(vec2(10u, 20u)) % vec2(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 0000000000..f8fb92dcd9 --- /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 0000000000..d7adb8ea37 --- /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 0000000000..89b56277e5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SMod_MixedSignednessOperands_SpvBinaryArithTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = (int2(30, 40) % as_type(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 0000000000..84a80e3467 --- /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 0000000000..115838f79f --- /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 = (vec2(30, 40) % bitcast>(vec2(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 0000000000..fa9be0ce58 --- /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 0000000000..be2c6ae4a1 --- /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 0000000000..4d6bc4757f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..8ab36ff44b --- /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 0000000000..88c4d0077b --- /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 0000000000..1beca7f93a --- /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 0000000000..3b023f477a --- /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 0000000000..3808cd9dc9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_SMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..59b9622bbe --- /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 0000000000..9fff9497a5 --- /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 = (vec2(30, 40) % vec2(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 0000000000..29dc1c65ed --- /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 0000000000..da4c40ab3e --- /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 0000000000..9d374056ce --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = (30 << as_type(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 0000000000..bea7497726 --- /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 0000000000..f9c9c0f667 --- /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(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 0000000000..39935a49fb --- /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 0000000000..bb099524ec --- /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 0000000000..daa90a30bb --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = (10u << as_type(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 0000000000..34f6aac095 --- /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 0000000000..c21ba25009 --- /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(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 0000000000..2627343efb --- /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 0000000000..3298030de4 --- /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 0000000000..f585f561c2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..35025bb146 --- /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 0000000000..2f07877623 --- /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 = (vec2(10u, 20u) << vec2(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 0000000000..d93a17f929 --- /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 0000000000..50533a4204 --- /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 0000000000..92b03c4214 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = (int2(30, 40) << as_type(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 0000000000..7f96e9d4d6 --- /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 0000000000..a9e670d8f5 --- /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 = (vec2(30, 40) << bitcast>(vec2(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 0000000000..00c911b714 --- /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 0000000000..522b2a9218 --- /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 0000000000..59a5762821 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..e4924679c0 --- /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 0000000000..b7d926adc4 --- /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 0000000000..1e3b356d1b --- /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 0000000000..684e4bb2a6 --- /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 0000000000..868ba01c55 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..50df6f951a --- /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 0000000000..8861845c07 --- /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 0000000000..35f4a5b43e --- /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 0000000000..3298030de4 --- /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 0000000000..f585f561c2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..35025bb146 --- /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 0000000000..2f07877623 --- /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 = (vec2(10u, 20u) << vec2(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 0000000000..66b92376d7 --- /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 0000000000..7dfc099807 --- /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 0000000000..f600d43240 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_Arg2Unsigned_SpvBinaryBitTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..98a3f34688 --- /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 0000000000..bfa4807765 --- /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 = (vec2(30, 40) << vec2(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 0000000000..e30a3340d2 --- /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 0000000000..e6cfa853df --- /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 0000000000..cee25833f3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type((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 0000000000..b038d3850b --- /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 0000000000..244c276d1e --- /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((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 0000000000..7b86de0222 --- /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 0000000000..ae6e09351d --- /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 0000000000..1fca25d8ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftLeftLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type((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 0000000000..944951735d --- /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 0000000000..a85aabcb95 --- /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 = bitcast>((vec2(30, 40) << vec2(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 0000000000..fa38fa03f2 --- /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 0000000000..aa6d2b6571 --- /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 0000000000..6d7d9b732f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type((as_type(10u) >> as_type(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 0000000000..abac46ad02 --- /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 0000000000..b9dfa9ab9d --- /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((bitcast(10u) >> bitcast(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 0000000000..4d9941fa72 --- /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 0000000000..1f3d8f56cb --- /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 0000000000..c18e6c1edb --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = (30 >> as_type(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 0000000000..7e7dc5d07d --- /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 0000000000..12b8f3c30b --- /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(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 0000000000..d9346ee3cb --- /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 0000000000..254af383ce --- /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 0000000000..28def88800 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type((as_type(uint2(10u, 20u)) >> as_type(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 0000000000..1e63192f09 --- /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 0000000000..1c0238ad06 --- /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 = bitcast>((bitcast>(vec2(10u, 20u)) >> bitcast>(vec2(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 0000000000..15d9239623 --- /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 0000000000..2627d37e78 --- /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 0000000000..eb98703a96 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = (int2(40, 30) >> as_type(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 0000000000..069612bbb8 --- /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 0000000000..d38f1fc9a5 --- /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 = (vec2(40, 30) >> bitcast>(vec2(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 0000000000..0b11836ed4 --- /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 0000000000..4221afae7d --- /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 0000000000..eb4dbee43c --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type((as_type(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 0000000000..dc1f00769a --- /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 0000000000..5e1b62524d --- /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((bitcast(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 0000000000..3e438fe1a0 --- /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 0000000000..d7265d3841 --- /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 0000000000..380a4a7246 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..2653c8c4d3 --- /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 0000000000..057af01a79 --- /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 0000000000..a3ac94f9b9 --- /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 0000000000..971b55bfd9 --- /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 0000000000..a193e22c4e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type((as_type(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 0000000000..8b7e238cf4 --- /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 0000000000..ae84fd1564 --- /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 = bitcast>((bitcast>(vec2(10u, 20u)) >> vec2(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 0000000000..63b94375dc --- /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 0000000000..4cfc73b143 --- /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 0000000000..45f142496a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..a471451242 --- /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 0000000000..84ea2b5b0a --- /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 = (vec2(40, 30) >> vec2(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 0000000000..dc1e7a9ad0 --- /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 0000000000..ec77cf8cd5 --- /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 0000000000..33ceeba5b0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type((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 0000000000..d1fc4184e2 --- /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 0000000000..23cb77e40c --- /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((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 0000000000..0d6213ecb1 --- /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 0000000000..c5ef15540c --- /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 0000000000..97283a00a3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightArithmetic_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type((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 0000000000..e6af6ba4f8 --- /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 0000000000..c37f278b84 --- /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 = bitcast>((vec2(30, 40) >> vec2(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 0000000000..c576fbbe2c --- /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 0000000000..a089bbac23 --- /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 0000000000..e4ef80b587 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = (10u >> as_type(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 0000000000..cc52d64342 --- /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 0000000000..2334466576 --- /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(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 0000000000..9d01d7c888 --- /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 0000000000..7764fc7b9b --- /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 0000000000..1cf94f6dec --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = as_type((as_type(30) >> as_type(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 0000000000..26de32f6d7 --- /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 0000000000..dcfcc289ce --- /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((bitcast(30) >> bitcast(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 0000000000..caa32f3043 --- /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 0000000000..fccd02bdcb --- /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 0000000000..bea342ced5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = (uint2(10u, 20u) >> as_type(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 0000000000..a160b65ee1 --- /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 0000000000..236e3120f2 --- /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 = (vec2(10u, 20u) >> bitcast>(vec2(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 0000000000..36152e1ec2 --- /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 0000000000..1781994b71 --- /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 0000000000..496df3775f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Signed_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = as_type((as_type(int2(40, 30)) >> as_type(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 0000000000..adc4f06629 --- /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 0000000000..d210ae2d62 --- /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 = bitcast>((bitcast>(vec2(40, 30)) >> bitcast>(vec2(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 0000000000..bb84015ddd --- /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 0000000000..fe69c41724 --- /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 0000000000..b9f45a40ef --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..2ff1d3d69d --- /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 0000000000..dcce358b7f --- /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 0000000000..cb76e4e670 --- /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 0000000000..cce77bf8d0 --- /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 0000000000..fe03581844 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = as_type((as_type(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 0000000000..bae8ebb2f2 --- /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 0000000000..d946dd9c2a --- /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((bitcast(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 0000000000..64fb2d06b0 --- /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 0000000000..e14739a7b6 --- /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 0000000000..15ddfb1bef --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..14d913ca58 --- /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 0000000000..d9431029fb --- /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 = (vec2(10u, 20u) >> vec2(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 0000000000..d62644aca9 --- /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 0000000000..33234e97be --- /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 0000000000..89ed12c349 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_Arg2Unsigned_SpvBinaryBitGeneralTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = as_type((as_type(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 0000000000..6cada59a4a --- /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 0000000000..57706fe1f5 --- /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 = bitcast>((bitcast>(vec2(30, 40)) >> vec2(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 0000000000..e1fc09d496 --- /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 0000000000..6d3a42eb63 --- /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 0000000000..b434eeaea2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = as_type((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 0000000000..4793ea03e8 --- /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 0000000000..debcad5d2e --- /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((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 0000000000..3680478da3 --- /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 0000000000..2ac568f141 --- /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 0000000000..1f77cfb100 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ShiftRightLogical_BitcastResult_SpvBinaryBitGeneralTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = as_type((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 0000000000..68f9a1dd2c --- /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 0000000000..6a821a62d5 --- /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 = bitcast>((vec2(10u, 20u) >> vec2(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 0000000000..ebe4ed5ff5 --- /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 0000000000..f1d2dd71eb --- /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 0000000000..788d3893d4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..6dac704f19 --- /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 0000000000..a2119693f3 --- /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 0000000000..b5332dfd40 --- /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 0000000000..ec26f7fdd0 --- /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 0000000000..9adf36ccbb --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UDiv_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..7f0bf43b1c --- /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 0000000000..572afb772b --- /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 = (vec2(10u, 20u) / vec2(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 0000000000..228eaab8b8 --- /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 0000000000..269dbdc8a8 --- /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 0000000000..79726d6c4b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..ea7e086b60 --- /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 0000000000..d1568ccd75 --- /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 0000000000..5dcb6ed9c5 --- /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 0000000000..101a66340e --- /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 0000000000..4c3627a129 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (as_type(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 0000000000..3a28cbf8ab --- /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 0000000000..6f61fad761 --- /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(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 0000000000..a371aa8d35 --- /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 0000000000..eaab66ff5e --- /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 0000000000..a860f023b6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (10u >= as_type(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 0000000000..3aa963328c --- /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 0000000000..6a480974f5 --- /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(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 0000000000..fab3410131 --- /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 0000000000..18bea18cb2 --- /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 0000000000..caaa4c0bcc --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..2dda07de28 --- /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 0000000000..484b06f373 --- /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 = (vec2(10u, 20u) >= vec2(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 0000000000..2451a4185f --- /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 0000000000..50cb12fe41 --- /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 0000000000..29ebb85676 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (as_type(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 0000000000..85c6ef16e1 --- /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 0000000000..b5c1d5d956 --- /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 = (bitcast>(vec2(30, 40)) >= vec2(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 0000000000..3912b2907a --- /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 0000000000..569fa4d8a8 --- /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 0000000000..e83f2e9146 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (uint2(10u, 20u) >= as_type(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 0000000000..62f78c72ff --- /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 0000000000..e22ecaa34c --- /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 = (vec2(10u, 20u) >= bitcast>(vec2(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 0000000000..2b56077036 --- /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 0000000000..395694ea36 --- /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 0000000000..f92a651cd7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..4ffd4adba6 --- /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 0000000000..ba1b933dd9 --- /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 0000000000..1d1350de96 --- /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 0000000000..616c20bf55 --- /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 0000000000..ca095b2b7f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (as_type(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 0000000000..c5a189bd56 --- /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 0000000000..5b6248669d --- /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(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 0000000000..64aaaac2fa --- /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 0000000000..e01e8e3f92 --- /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 0000000000..cdd8212d35 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (10u > as_type(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 0000000000..c2611bc483 --- /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 0000000000..52b49151ec --- /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(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 0000000000..5d538a37af --- /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 0000000000..22ada319ca --- /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 0000000000..98af0481e1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..1ab95a8bbf --- /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 0000000000..fb4133200f --- /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 = (vec2(10u, 20u) > vec2(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 0000000000..20ca9befad --- /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 0000000000..611e248e1f --- /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 0000000000..6aebfa0f4f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (as_type(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 0000000000..2b177eb625 --- /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 0000000000..33324fc1dd --- /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 = (bitcast>(vec2(30, 40)) > vec2(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 0000000000..cf2b03a6f6 --- /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 0000000000..99e15f78cb --- /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 0000000000..fac467f02a --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UGreaterThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (uint2(10u, 20u) > as_type(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 0000000000..c13dfc60fb --- /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 0000000000..726a9cb397 --- /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 = (vec2(10u, 20u) > bitcast>(vec2(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 0000000000..b6eadb008e --- /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 0000000000..b4b48a8355 --- /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 0000000000..565f43e572 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..c9fd16cd31 --- /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 0000000000..4ca1576d47 --- /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 0000000000..d1d40957f8 --- /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 0000000000..ebaa6757d6 --- /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 0000000000..0449677575 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (as_type(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 0000000000..4d4fc86af6 --- /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 0000000000..4bdbb7bb61 --- /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(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 0000000000..c2a34957d7 --- /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 0000000000..5134767470 --- /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 0000000000..bf2bbadf62 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (10u <= as_type(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 0000000000..94a4a39fc9 --- /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 0000000000..78fb0eb4a3 --- /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(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 0000000000..e237f8a468 --- /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 0000000000..aadcc08da8 --- /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 0000000000..603faf2594 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..9fb58929a5 --- /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 0000000000..a72937f17c --- /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 = (vec2(10u, 20u) <= vec2(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 0000000000..7ed1e923e2 --- /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 0000000000..fe3cd843d8 --- /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 0000000000..5779984b68 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (as_type(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 0000000000..44c3f9a1f2 --- /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 0000000000..1a31f7ce88 --- /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 = (bitcast>(vec2(30, 40)) <= vec2(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 0000000000..84ae772612 --- /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 0000000000..84c03db482 --- /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 0000000000..ec6c1fcedf --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ULessThanEqual_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (uint2(10u, 20u) <= as_type(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 0000000000..158173afcf --- /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 0000000000..0f7d1fe91a --- /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 = (vec2(10u, 20u) <= bitcast>(vec2(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 0000000000..0947de5082 --- /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 0000000000..58fdafc61e --- /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 0000000000..600fb979f7 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..f1cdb11934 --- /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 0000000000..da0007f9c5 --- /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 0000000000..acf7f4b7cb --- /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 0000000000..88c9a0b69b --- /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 0000000000..56104b5c58 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (as_type(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 0000000000..f441af66f7 --- /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 0000000000..d82804a291 --- /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(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 0000000000..651d986a76 --- /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 0000000000..faa27859b6 --- /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 0000000000..a5f3097f84 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_2.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool const x_1 = (10u < as_type(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 0000000000..b67846274d --- /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 0000000000..095014f682 --- /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(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 0000000000..6b128ae912 --- /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 0000000000..5a53bda8bd --- /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 0000000000..a1ca897a18 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_3.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..984ef08a86 --- /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 0000000000..c2c259946e --- /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 = (vec2(10u, 20u) < vec2(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 0000000000..8801e12277 --- /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 0000000000..2b6fcf6630 --- /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 0000000000..749f7faf70 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_4.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (as_type(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 0000000000..4cad910ee0 --- /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 0000000000..2a91bceec8 --- /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 = (bitcast>(vec2(30, 40)) < vec2(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 0000000000..fa0e3fa040 --- /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 0000000000..bef764da7d --- /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 0000000000..52e34c4b04 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ULessThan_SpvBinaryLogicalTest_EmitExpression_5.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + bool2 const x_1 = (uint2(10u, 20u) < as_type(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 0000000000..c84e351b5c --- /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 0000000000..5039a1517c --- /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 = (vec2(10u, 20u) < bitcast>(vec2(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 0000000000..c41f03e53b --- /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 0000000000..c02baafa32 --- /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 0000000000..f5eaa380e9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_0.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..fcc8b647e8 --- /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 0000000000..5c6fcbb964 --- /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 0000000000..7ca3f9deb1 --- /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 0000000000..31e72107f3 --- /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 0000000000..7cbfbb8b4f --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_UMod_SpvBinaryArithTest_EmitExpression_1.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..7595701963 --- /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 0000000000..d62348761e --- /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 = (vec2(10u, 20u) % vec2(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 0000000000..89d5db4e0a --- /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 0000000000..4998500429 --- /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 0000000000..c1a3641b9b --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_ValueFromBlockNotInBlockOrder.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..483c56376c --- /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 0000000000..5629082a38 --- /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 0000000000..49be6456f7 --- /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 0000000000..5204289911 --- /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 0000000000..77e55e8ac3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..a5b74dec12 --- /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 0000000000..3ba0951c20 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_SignedIndex.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + let x_1 : vec2 = vec2(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 0000000000..30794bfe59 --- /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 0000000000..69071542e7 --- /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 0000000000..2d7efeffd2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..c5b37ff26e --- /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 0000000000..a48d2d8e88 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_VectorExtractDynamic_UnsignedIndex.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + let x_1 : vec2 = vec2(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 0000000000..3ea4c8ef63 --- /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 0000000000..1c7138d065 --- /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 0000000000..431e568ac1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.msl @@ -0,0 +1,24 @@ +#include + +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 0000000000..dc8985970d --- /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 0000000000..cd22d95150 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_VectorInsertDynamic_Sample.spvasm.expected.wgsl @@ -0,0 +1,20 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + let x_1 : vec2 = vec2(3u, 4u); + let x_2 : u32 = 3u; + let x_3 : i32 = 1; + var x_10_1 : vec2 = x_1; + x_10_1[x_3] = x_2; + let x_10 : vec2 = 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 0000000000..d18522611f --- /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 0000000000..d4440e7488 --- /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 0000000000..f67f345d76 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.msl @@ -0,0 +1,20 @@ +#include + +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 0000000000..f63ae416f5 --- /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 0000000000..cb4f32f6c8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_AllOnesMapToNull.spvasm.expected.wgsl @@ -0,0 +1,16 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + let x_1 : vec2 = vec2(4u, 3u); + let x_10 : vec2 = vec2(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 0000000000..fd623103c7 --- /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 0000000000..8ac641185b --- /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 0000000000..54f9b82a42 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +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 0000000000..d7b00843b1 --- /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 0000000000..76fc929321 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_ConstantOperands_UseBoth.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + let x_10 : vec4 = vec4(vec2(4u, 3u).y, vec2(4u, 3u).x, vec2(3u, 4u).y, vec2(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 0000000000..b360b5da9f --- /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 0000000000..be343bb9e6 --- /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 0000000000..7532ca977e --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.msl @@ -0,0 +1,21 @@ +#include + +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 0000000000..36eecadac2 --- /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 0000000000..a82b9de509 --- /dev/null +++ b/test/unittest/reader/spirv/SpvParserTest_VectorShuffle_FunctionScopeOperands_UseBoth.spvasm.expected.wgsl @@ -0,0 +1,17 @@ +struct S { + field0 : vec2; + field1 : u32; + field2 : i32; +}; + +fn main_1() { + let x_1 : vec2 = vec2(3u, 4u); + let x_2 : vec2 = (vec2(4u, 3u) + vec2(3u, 4u)); + let x_10 : vec4 = vec4(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 0000000000..3d55d5e2b2 --- /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 0000000000..e369a1a068 --- /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 0000000000..bbfcf2d8fc --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Scalar.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..0d238ba27a --- /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 0000000000..054b45d91a --- /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 0000000000..db365dfd56 --- /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 0000000000..0bb1446656 --- /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 0000000000..245fc9117c --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..dd99469581 --- /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 0000000000..4f9098608c --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_FNegate_Vector.spvasm.expected.wgsl @@ -0,0 +1,9 @@ +fn main_1() { + let x_1 : vec2 = -(vec2(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 0000000000..07bbbf40ce --- /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 0000000000..dda227d1df --- /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 0000000000..8a0cc68dd4 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Int.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..a82b84c04a --- /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 0000000000..e45ce36a28 --- /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 0000000000..9166c7e44a --- /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 0000000000..e1f744fc11 --- /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 0000000000..9a0b0f7dfa --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Int_Uint.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = -(as_type(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 0000000000..d08b1920d2 --- /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 0000000000..a724b62c10 --- /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(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 0000000000..d21de105a7 --- /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 0000000000..05ee1e8514 --- /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 0000000000..37bd39b4ae --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_SignedVec.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..fd0c186ac3 --- /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 0000000000..ca508f62f3 --- /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 = -(vec2(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 0000000000..16e53042e4 --- /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 0000000000..a5aa25fc4c --- /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 0000000000..24c5e3c9a8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_SignedVec_UnsignedVec.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = -(as_type(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 0000000000..4c5d463147 --- /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 0000000000..12ce5371c9 --- /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 = -(bitcast>(vec2(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 0000000000..8e67394d81 --- /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 0000000000..3f8072a7b0 --- /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 0000000000..7afd7f08dd --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Int.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type(-(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 0000000000..f819fda7a0 --- /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 0000000000..1b940b1fe5 --- /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(-(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 0000000000..273cfb61cb --- /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 0000000000..804956a1b9 --- /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 0000000000..181216d1ed --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_Uint_Uint.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type(-(as_type(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 0000000000..dcb1e682b7 --- /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 0000000000..2a97574686 --- /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(-(bitcast(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 0000000000..42c4e4acd4 --- /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 0000000000..c89b09b132 --- /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 0000000000..73a6e7e6cf --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_SignedVec.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type(-(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 0000000000..d030846eb8 --- /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 0000000000..480baacd65 --- /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 = bitcast>(-(vec2(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 0000000000..2ce12b3f15 --- /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 0000000000..bb343421db --- /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 0000000000..b557aefd00 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_SNegate_UnsignedVec_UnsignedVec.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type(-(as_type(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 0000000000..bed8b430ee --- /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 0000000000..de725acaab --- /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 = bitcast>(-(bitcast>(vec2(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 0000000000..8ab3975fde --- /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 0000000000..3ce255a3d9 --- /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 0000000000..25b6177e97 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..df2b1254cf --- /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 0000000000..751df07843 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x2.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +fn main_1() { + let x_1 : mat2x2 = mat2x2(vec2(50.0, 60.0), vec2(60.0, 50.0)); + let x_2 : mat2x2 = 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 0000000000..41cfa82698 --- /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 0000000000..37a218a8e3 --- /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 0000000000..9f4e66f43d --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..9aa68e1750 --- /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 0000000000..4de5b41293 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_2x3.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +fn main_1() { + let x_1 : mat2x3 = mat2x3(vec3(50.0, 60.0, 70.0), vec3(60.0, 70.0, 50.0)); + let x_2 : mat3x2 = 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 0000000000..8ef234febe --- /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 0000000000..c95ec77d2a --- /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 0000000000..9262636db0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..5629bf1790 --- /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 0000000000..69ed3f8108 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryArithTest_Transpose_3x2.spvasm.expected.wgsl @@ -0,0 +1,10 @@ +fn main_1() { + let x_1 : mat3x2 = mat3x2(vec2(50.0, 60.0), vec2(60.0, 50.0), vec2(50.0, 60.0)); + let x_2 : mat2x3 = 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 0000000000..828c2390ef --- /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 0000000000..a74cb65e3f --- /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 0000000000..5e5318b3e9 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_IntVector.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..6b32833c58 --- /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 0000000000..160253185c --- /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 = vec2(10u, 20u); + let v2i1 : vec2 = vec2(30, 40); + let x_1 : vec2 = 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 0000000000..d89081638b --- /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 0000000000..7e6c5c94bf --- /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 0000000000..8534554197 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_IntVector_UintVector.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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(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 0000000000..19f814f586 --- /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 0000000000..b026757aad --- /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 = vec2(10u, 20u); + let v2i1 : vec2 = vec2(30, 40); + let x_1 : vec2 = bitcast>(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 0000000000..6654c0c0fa --- /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 0000000000..7b091c888e --- /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 0000000000..2926cf7a94 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Int.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..39559ddde5 --- /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 0000000000..a5be6f61e0 --- /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 = vec2(10u, 20u); + let v2i1 : vec2 = vec2(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 0000000000..4a09ef0ccc --- /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 0000000000..c63362f95a --- /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 0000000000..da169f42b6 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Int_Uint.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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(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 0000000000..8b67a15dc6 --- /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 0000000000..56eb02d185 --- /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 = vec2(10u, 20u); + let v2i1 : vec2 = vec2(30, 40); + let x_1 : i32 = bitcast(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 0000000000..2cc0c935dd --- /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 0000000000..39bb2b51e7 --- /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 0000000000..c7677e790d --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_IntVector.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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(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 0000000000..623cfd22ee --- /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 0000000000..ae46259c12 --- /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 = vec2(10u, 20u); + let v2i1 : vec2 = vec2(30, 40); + let x_1 : vec2 = bitcast>(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 0000000000..c4ee216294 --- /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 0000000000..061d8883b8 --- /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 0000000000..5c913c0abd --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_UintVector_UintVector.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..217cc0f667 --- /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 0000000000..70ee7e754c --- /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 = vec2(10u, 20u); + let v2i1 : vec2 = vec2(30, 40); + let x_1 : vec2 = 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 0000000000..34c87023ae --- /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 0000000000..f63081785b --- /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 0000000000..898195b131 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Int.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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(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 0000000000..b5086440c2 --- /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 0000000000..df7f6e52ea --- /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 = vec2(10u, 20u); + let v2i1 : vec2 = vec2(30, 40); + let x_1 : u32 = bitcast(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 0000000000..8b9d40a9d7 --- /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 0000000000..e61ae04ac5 --- /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 0000000000..586570ab3d --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitCount_Uint_Uint.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..54532f3597 --- /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 0000000000..3a5002258f --- /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 = vec2(10u, 20u); + let v2i1 : vec2 = vec2(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 0000000000..a801877381 --- /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 0000000000..0b913fdf2e --- /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 0000000000..84640e6983 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_IntVector_IntVector.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..e6dd3b9c86 --- /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 0000000000..97da394a10 --- /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 = vec2(10u, 20u); + let v2i1 : vec2 = vec2(30, 40); + let x_1 : vec2 = 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 0000000000..75679589ab --- /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 0000000000..a73c3bb846 --- /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 0000000000..362484c44d --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Int_Int.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..b164bbedf4 --- /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 0000000000..b4f28a13cc --- /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 = vec2(10u, 20u); + let v2i1 : vec2 = vec2(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 0000000000..cdfc2adb7b --- /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 0000000000..a00c844534 --- /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 0000000000..c43e1a2d8e --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_UintVector_UintVector.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..6f35e4fe6a --- /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 0000000000..d8fc5b216c --- /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 = vec2(10u, 20u); + let v2i1 : vec2 = vec2(30, 40); + let x_1 : vec2 = 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 0000000000..8e061a2ad9 --- /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 0000000000..3fbf216f6e --- /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 0000000000..46ed69fa46 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_BitReverse_Uint_Uint.spvasm.expected.msl @@ -0,0 +1,17 @@ +#include + +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 0000000000..198d84ae14 --- /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 0000000000..e6bc8af972 --- /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 = vec2(10u, 20u); + let v2i1 : vec2 = vec2(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 0000000000..1c58585169 --- /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 0000000000..d2088a6172 --- /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 0000000000..2a5889c458 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Int.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..de9da51266 --- /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 0000000000..ba77c8b492 --- /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 0000000000..72852377bb --- /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 0000000000..419c8eb39c --- /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 0000000000..25d88c1036 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Int_Uint.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int const x_1 = as_type(~(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 0000000000..a9f45443ca --- /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 0000000000..4a0d1d24c6 --- /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(~(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 0000000000..9954fda4ab --- /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 0000000000..c31086eec2 --- /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 0000000000..49ddd7cc8a --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_SignedVec.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..216d11c8b9 --- /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 0000000000..f995c02b35 --- /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 = ~(vec2(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 0000000000..411a1317f1 --- /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 0000000000..4afab65655 --- /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 0000000000..c856d535d8 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_SignedVec_UnsignedVec.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_1 = as_type(~(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 0000000000..2cdcffdb36 --- /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 0000000000..0e9634aeea --- /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 = bitcast>(~(vec2(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 0000000000..df06328590 --- /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 0000000000..412cd83cc8 --- /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 0000000000..31af6b7fcd --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Int.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type(~(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 0000000000..de53b0fb48 --- /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 0000000000..33488fcc3d --- /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(~(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 0000000000..7471b602a6 --- /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 0000000000..c6bcbd380e --- /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 0000000000..8a0b29fd57 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_Uint_Uint.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..52708c0dc7 --- /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 0000000000..b5b57378e1 --- /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 0000000000..80d91a7d5f --- /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 0000000000..23e8405d0d --- /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 0000000000..a36ed9445d --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_SignedVec.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_1 = as_type(~(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 0000000000..5a5760f414 --- /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 0000000000..599e40c5e2 --- /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 = bitcast>(~(vec2(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 0000000000..65a4a8129a --- /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 0000000000..6dce691a1a --- /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 0000000000..466557ed40 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryBitTest_Not_UnsignedVec_UnsignedVec.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..56fd96eb20 --- /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 0000000000..365232c705 --- /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 = ~(vec2(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 0000000000..d3be0e679c --- /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 0000000000..50712af61e --- /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 0000000000..f49756ac5b --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Scalar.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + uint const x_1 = as_type(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 0000000000..3f9dc7d755 --- /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 0000000000..bc3e4f0901 --- /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(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 0000000000..4277cf9aca --- /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 0000000000..5fa03158a6 --- /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 0000000000..e9a42bd184 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +using namespace metal; +void main_1() { + float2 const x_1 = as_type(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 0000000000..4e1b6a31fb --- /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 0000000000..b246e5cbf5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_Bitcast_Vector.spvasm.expected.wgsl @@ -0,0 +1,9 @@ +fn main_1() { + let x_1 : vec2 = bitcast>(vec2(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 0000000000..38fb69d2b5 --- /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 0000000000..37bf3ea517 --- /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 0000000000..63ba1306f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToSigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..dafa8c6cfa --- /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 0000000000..67c9af7c64 --- /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 0000000000..7122c9b299 --- /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 0000000000..cf36d40a44 --- /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 0000000000..dde58106f5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Scalar_ToUnsigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void main_1() { + float const x_30 = 50.0f; + uint const x_1 = as_type(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 0000000000..4e71a6a908 --- /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 0000000000..a1e3904ebd --- /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(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 0000000000..bcac2ac30b --- /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 0000000000..d3c33334c2 --- /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 0000000000..e576c461f2 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToSigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..985a540465 --- /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 0000000000..8e28abbdb0 --- /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 = vec2(50.0, 60.0); + let x_1 : vec2 = vec2(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 0000000000..e4ceaa529a --- /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 0000000000..5ebd2d563f --- /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 0000000000..9205302011 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToS_Vector_ToUnsigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void main_1() { + float2 const x_30 = float2(50.0f, 60.0f); + uint2 const x_1 = as_type(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 0000000000..1b4a5a0cd9 --- /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 0000000000..87519d5ccf --- /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 = vec2(50.0, 60.0); + let x_1 : vec2 = bitcast>(vec2(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 0000000000..48e2b14fe7 --- /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 0000000000..0b7e61f89f --- /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 0000000000..35623e066c --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_HoistedValue.spvasm.expected.msl @@ -0,0 +1,25 @@ +#include + +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 0000000000..6d41788bdb --- /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 0000000000..66782851f4 --- /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 0000000000..16e12c5496 --- /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 0000000000..f9bd3d12ec --- /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 0000000000..5816307e5d --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Scalar_ToUnsigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..d92f19df4e --- /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 0000000000..d5fc2a044d --- /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 0000000000..96ba6fc3e2 --- /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 0000000000..e3598e10ad --- /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 0000000000..f625fd7125 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertFToU_Vector_ToUnsigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..3382ffd32f --- /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 0000000000..0a566090cd --- /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 = vec2(50.0, 60.0); + let x_1 : vec2 = vec2(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 0000000000..5a2eec8e50 --- /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 0000000000..15cffe5675 --- /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 0000000000..7d826c9b1f --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromSigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..01149f4b96 --- /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 0000000000..f2a25de740 --- /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 0000000000..64806a5026 --- /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 0000000000..69adf2fdab --- /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 0000000000..81eb6593a3 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Scalar_FromUnsigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void main_1() { + uint const x_30 = 10u; + float const x_1 = float(as_type(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 0000000000..4c858de735 --- /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 0000000000..4dfbe0a93f --- /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(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 0000000000..eced5c0962 --- /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 0000000000..ec2760549e --- /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 0000000000..3d1641c5a5 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromSigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..1ae6382a51 --- /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 0000000000..890b5ef3a4 --- /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 = vec2(30, 40); + let x_1 : vec2 = vec2(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 0000000000..098e2893e1 --- /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 0000000000..3c0339309e --- /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 0000000000..a465e1b136 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertSToF_Vector_FromUnsigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void main_1() { + uint2 const x_30 = uint2(10u, 20u); + float2 const x_1 = float2(as_type(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 0000000000..84c993d4f7 --- /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 0000000000..4b89c49fa1 --- /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 = vec2(10u, 20u); + let x_1 : vec2 = vec2(bitcast>(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 0000000000..661a4f1276 --- /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 0000000000..ceb60686c7 --- /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 0000000000..bbba1276f1 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromSigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void main_1() { + int const x_30 = 30; + float const x_1 = float(as_type(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 0000000000..6dff3cf51f --- /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 0000000000..c441a830b3 --- /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(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 0000000000..cb14cb92e4 --- /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 0000000000..9cf6f1142f --- /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 0000000000..67605f2879 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Scalar_FromUnsigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..fa7fada119 --- /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 0000000000..97057ca4a2 --- /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 0000000000..ccdafc90da --- /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 0000000000..78b77470c6 --- /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 0000000000..332c882a05 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromSigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +using namespace metal; +void main_1() { + int2 const x_30 = int2(30, 40); + float2 const x_1 = float2(as_type(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 0000000000..0459c16e32 --- /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 0000000000..f0901ef0af --- /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 = vec2(30, 40); + let x_1 : vec2 = vec2(bitcast>(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 0000000000..c8b860f217 --- /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 0000000000..1850a19d8f --- /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 0000000000..dc3b443e4b --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryConversionTest_ConvertUToF_Vector_FromUnsigned.spvasm.expected.msl @@ -0,0 +1,14 @@ +#include + +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 0000000000..597f34ce13 --- /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 0000000000..7a949fddb4 --- /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 = vec2(10u, 20u); + let x_1 : vec2 = vec2(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 0000000000..1e3842c04e --- /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 0000000000..971e568ded --- /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 0000000000..b29b9ed3a0 --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Scalar.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..c5b17805e0 --- /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 0000000000..8619a46042 --- /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 0000000000..3dc45aaf20 --- /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 0000000000..96a249d530 --- /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 0000000000..69e0b18eef --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.msl @@ -0,0 +1,13 @@ +#include + +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 0000000000..cc48336a41 --- /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 0000000000..71c370b00d --- /dev/null +++ b/test/unittest/reader/spirv/SpvUnaryLogicalTest_LogicalNot_Vector.spvasm.expected.wgsl @@ -0,0 +1,9 @@ +fn main_1() { + let x_1 : vec2 = !(vec2(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 0000000000..2035e68f76 --- /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 0000000000..113536831c --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..ca944f0cc9 --- /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 0000000000..471e2a6e06 --- /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 0000000000..2bd46432ba --- /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 0000000000..113536831c --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..ca944f0cc9 --- /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 0000000000..471e2a6e06 --- /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 0000000000..6053a70e7b --- /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 0000000000..113536831c --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..ca944f0cc9 --- /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 0000000000..471e2a6e06 --- /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 0000000000..1df3a9d892 --- /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 0000000000..113536831c --- /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 0000000000..b0c5c47d25 --- /dev/null +++ b/test/unittest/reader/spirv/ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm.expected.msl @@ -0,0 +1,12 @@ +#include + +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 0000000000..ca944f0cc9 --- /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 0000000000..471e2a6e06 --- /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(); +}