diff --git a/test/bug/tint/219.spvasm b/test/bug/tint/219.spvasm new file mode 100644 index 0000000000..b706fc126a --- /dev/null +++ b/test/bug/tint/219.spvasm @@ -0,0 +1,30 @@ + OpCapability Shader + OpMemoryModel Logical Simple + OpEntryPoint GLCompute %100 "main" + OpExecutionMode %100 LocalSize 1 1 1 + %void = OpTypeVoid + %voidfn = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%ptr_v2f = OpTypePointer Function %v2float + %ptr_f = OpTypePointer Function %float +%floatfn = OpTypeFunction %float %ptr_v2f + + %200 = OpFunction %float None %floatfn + %201 = OpFunctionParameter %ptr_v2f + + %210 = OpLabel + %211 = OpAccessChain %ptr_f %201 %uint_0 + %212 = OpLoad %float %211 + OpReturnValue %212 + OpFunctionEnd + + + %100 = OpFunction %void None %voidfn + %10 = OpLabel + %11 = OpVariable %ptr_v2f Function + %f = OpFunctionCall %float %200 %11 + OpReturn + OpFunctionEnd diff --git a/test/bug/tint/219.spvasm.expected.hlsl b/test/bug/tint/219.spvasm.expected.hlsl new file mode 100644 index 0000000000..f8a2ad7099 --- /dev/null +++ b/test/bug/tint/219.spvasm.expected.hlsl @@ -0,0 +1,16 @@ +float x_200(inout float2 x_201) { + const float x_212 = x_201.x; + return x_212; +} + +void main_1() { + float2 x_11 = float2(0.0f, 0.0f); + const float x_12 = x_200(x_11); + return; +} + +[numthreads(1, 1, 1)] +void main() { + main_1(); + return; +} diff --git a/test/bug/tint/219.spvasm.expected.msl b/test/bug/tint/219.spvasm.expected.msl new file mode 100644 index 0000000000..103a45b619 --- /dev/null +++ b/test/bug/tint/219.spvasm.expected.msl @@ -0,0 +1,19 @@ +#include + +using namespace metal; +float x_200(thread float2* const x_201) { + float const x_212 = (*(x_201)).x; + return x_212; +} + +void main_1() { + float2 x_11 = 0.0f; + float const x_12 = x_200(&(x_11)); + return; +} + +kernel void tint_symbol() { + main_1(); + return; +} + diff --git a/test/bug/tint/219.spvasm.expected.spvasm b/test/bug/tint/219.spvasm.expected.spvasm new file mode 100644 index 0000000000..1725762736 --- /dev/null +++ b/test/bug/tint/219.spvasm.expected.spvasm @@ -0,0 +1,42 @@ +; 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 %x_200 "x_200" + OpName %x_201 "x_201" + OpName %main_1 "main_1" + OpName %x_11 "x_11" + OpName %main "main" + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %1 = OpTypeFunction %float %_ptr_Function_v2float + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float + %void = OpTypeVoid + %14 = OpTypeFunction %void + %19 = OpConstantNull %v2float + %x_200 = OpFunction %float None %1 + %x_201 = OpFunctionParameter %_ptr_Function_v2float + %7 = OpLabel + %12 = OpAccessChain %_ptr_Function_float %x_201 %uint_0 + %13 = OpLoad %float %12 + OpReturnValue %13 + OpFunctionEnd + %main_1 = OpFunction %void None %14 + %17 = OpLabel + %x_11 = OpVariable %_ptr_Function_v2float Function %19 + %20 = OpFunctionCall %float %x_200 %x_11 + OpReturn + OpFunctionEnd + %main = OpFunction %void None %14 + %23 = OpLabel + %24 = OpFunctionCall %void %main_1 + OpReturn + OpFunctionEnd diff --git a/test/bug/tint/219.spvasm.expected.wgsl b/test/bug/tint/219.spvasm.expected.wgsl new file mode 100644 index 0000000000..0932553db2 --- /dev/null +++ b/test/bug/tint/219.spvasm.expected.wgsl @@ -0,0 +1,15 @@ +fn x_200(x_201 : ptr>) -> f32 { + let x_212 : f32 = (*(x_201)).x; + return x_212; +} + +fn main_1() { + var x_11 : vec2; + let x_12 : f32 = x_200(&(x_11)); + return; +} + +[[stage(compute), workgroup_size(1, 1, 1)]] +fn main() { + main_1(); +}