Add test case for tint:219
The original problem appears to be fixed.
Fixed: tint:219
Change-Id: I8d16fbb715da3ca149769699c86f86a4bed85b4f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57703
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/test/bug/tint/219.spvasm b/test/bug/tint/219.spvasm
new file mode 100644
index 0000000..b706fc1
--- /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 0000000..f8a2ad7
--- /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 0000000..103a45b
--- /dev/null
+++ b/test/bug/tint/219.spvasm.expected.msl
@@ -0,0 +1,19 @@
+#include <metal_stdlib>
+
+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 0000000..1725762
--- /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 0000000..0932553
--- /dev/null
+++ b/test/bug/tint/219.spvasm.expected.wgsl
@@ -0,0 +1,15 @@
+fn x_200(x_201 : ptr<function, vec2<f32>>) -> f32 {
+ let x_212 : f32 = (*(x_201)).x;
+ return x_212;
+}
+
+fn main_1() {
+ var x_11 : vec2<f32>;
+ let x_12 : f32 = x_200(&(x_11));
+ return;
+}
+
+[[stage(compute), workgroup_size(1, 1, 1)]]
+fn main() {
+ main_1();
+}