Const eval for `inverseSqrt`
This CL adds const-eval for the `inverseSqrt` builtin.
Bug: tint:1581
Change-Id: Ieef063416a8033b5fac9396e30c76c20b3360a90
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111581
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
diff --git a/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl
new file mode 100644
index 0000000..a63b143
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn inverseSqrt(vec<4, fa>) -> vec<4, fa>
+fn inverseSqrt_07a6fe() {
+ const arg_0 = vec4(1.);
+ var res = inverseSqrt(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_07a6fe();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ inverseSqrt_07a6fe();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_07a6fe();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..5068619
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void inverseSqrt_07a6fe() {
+ float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_07a6fe();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ inverseSqrt_07a6fe();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ inverseSqrt_07a6fe();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..5068619
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void inverseSqrt_07a6fe() {
+ float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_07a6fe();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ inverseSqrt_07a6fe();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ inverseSqrt_07a6fe();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.glsl
new file mode 100644
index 0000000..bc25b44
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void inverseSqrt_07a6fe() {
+ vec4 res = vec4(1.0f);
+}
+
+vec4 vertex_main() {
+ inverseSqrt_07a6fe();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+void inverseSqrt_07a6fe() {
+ vec4 res = vec4(1.0f);
+}
+
+void fragment_main() {
+ inverseSqrt_07a6fe();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void inverseSqrt_07a6fe() {
+ vec4 res = vec4(1.0f);
+}
+
+void compute_main() {
+ inverseSqrt_07a6fe();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.msl
new file mode 100644
index 0000000..51f4827
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void inverseSqrt_07a6fe() {
+ float4 res = float4(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_07a6fe();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ inverseSqrt_07a6fe();
+ return;
+}
+
+kernel void compute_main() {
+ inverseSqrt_07a6fe();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.spvasm
new file mode 100644
index 0000000..d9958fdd
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.spvasm
@@ -0,0 +1,64 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %inverseSqrt_07a6fe "inverseSqrt_07a6fe"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %17 = OpTypeFunction %v4float
+%inverseSqrt_07a6fe = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %17
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %inverseSqrt_07a6fe
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %22 = OpLabel
+ %23 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %23
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %inverseSqrt_07a6fe
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %inverseSqrt_07a6fe
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.wgsl
new file mode 100644
index 0000000..47572d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/07a6fe.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn inverseSqrt_07a6fe() {
+ const arg_0 = vec4(1.0);
+ var res = inverseSqrt(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_07a6fe();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ inverseSqrt_07a6fe();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_07a6fe();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl
new file mode 100644
index 0000000..ca09f89
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn inverseSqrt(fa) -> fa
+fn inverseSqrt_4ca6d6() {
+ const arg_0 = 1.;
+ var res = inverseSqrt(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_4ca6d6();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ inverseSqrt_4ca6d6();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_4ca6d6();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..9dc23af
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void inverseSqrt_4ca6d6() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_4ca6d6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ inverseSqrt_4ca6d6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ inverseSqrt_4ca6d6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..9dc23af
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void inverseSqrt_4ca6d6() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_4ca6d6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ inverseSqrt_4ca6d6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ inverseSqrt_4ca6d6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.glsl
new file mode 100644
index 0000000..5f7e5e4
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void inverseSqrt_4ca6d6() {
+ float res = 1.0f;
+}
+
+vec4 vertex_main() {
+ inverseSqrt_4ca6d6();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+void inverseSqrt_4ca6d6() {
+ float res = 1.0f;
+}
+
+void fragment_main() {
+ inverseSqrt_4ca6d6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void inverseSqrt_4ca6d6() {
+ float res = 1.0f;
+}
+
+void compute_main() {
+ inverseSqrt_4ca6d6();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.msl
new file mode 100644
index 0000000..9309f00
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void inverseSqrt_4ca6d6() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_4ca6d6();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ inverseSqrt_4ca6d6();
+ return;
+}
+
+kernel void compute_main() {
+ inverseSqrt_4ca6d6();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.spvasm
new file mode 100644
index 0000000..5228d5b
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.spvasm
@@ -0,0 +1,63 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %inverseSqrt_4ca6d6 "inverseSqrt_4ca6d6"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpTypeFunction %v4float
+%inverseSqrt_4ca6d6 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %res %float_1
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %inverseSqrt_4ca6d6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %21 = OpLabel
+ %22 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %22
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %inverseSqrt_4ca6d6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %inverseSqrt_4ca6d6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.wgsl
new file mode 100644
index 0000000..51abef2
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/4ca6d6.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn inverseSqrt_4ca6d6() {
+ const arg_0 = 1.0;
+ var res = inverseSqrt(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_4ca6d6();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ inverseSqrt_4ca6d6();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_4ca6d6();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl
new file mode 100644
index 0000000..bc3f3ee
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn inverseSqrt(vec<3, fa>) -> vec<3, fa>
+fn inverseSqrt_6d0783() {
+ const arg_0 = vec3(1.);
+ var res = inverseSqrt(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_6d0783();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ inverseSqrt_6d0783();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_6d0783();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..23ea6a39
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void inverseSqrt_6d0783() {
+ float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_6d0783();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ inverseSqrt_6d0783();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ inverseSqrt_6d0783();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..23ea6a39
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void inverseSqrt_6d0783() {
+ float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_6d0783();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ inverseSqrt_6d0783();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ inverseSqrt_6d0783();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.glsl
new file mode 100644
index 0000000..a8ccaba
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void inverseSqrt_6d0783() {
+ vec3 res = vec3(1.0f);
+}
+
+vec4 vertex_main() {
+ inverseSqrt_6d0783();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+void inverseSqrt_6d0783() {
+ vec3 res = vec3(1.0f);
+}
+
+void fragment_main() {
+ inverseSqrt_6d0783();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void inverseSqrt_6d0783() {
+ vec3 res = vec3(1.0f);
+}
+
+void compute_main() {
+ inverseSqrt_6d0783();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.msl
new file mode 100644
index 0000000..5ceb221
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void inverseSqrt_6d0783() {
+ float3 res = float3(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_6d0783();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ inverseSqrt_6d0783();
+ return;
+}
+
+kernel void compute_main() {
+ inverseSqrt_6d0783();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.spvasm
new file mode 100644
index 0000000..439383d
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %inverseSqrt_6d0783 "inverseSqrt_6d0783"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+%inverseSqrt_6d0783 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v3float Function %18
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %inverseSqrt_6d0783
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %inverseSqrt_6d0783
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %inverseSqrt_6d0783
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.wgsl
new file mode 100644
index 0000000..d0fdf1d
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/6d0783.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn inverseSqrt_6d0783() {
+ const arg_0 = vec3(1.0);
+ var res = inverseSqrt(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_6d0783();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ inverseSqrt_6d0783();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_6d0783();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl
new file mode 100644
index 0000000..4196cc8
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn inverseSqrt(vec<2, fa>) -> vec<2, fa>
+fn inverseSqrt_f60c1c() {
+ const arg_0 = vec2(1.);
+ var res = inverseSqrt(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_f60c1c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ inverseSqrt_f60c1c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_f60c1c();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..7318b17
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void inverseSqrt_f60c1c() {
+ float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_f60c1c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ inverseSqrt_f60c1c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ inverseSqrt_f60c1c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..7318b17
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void inverseSqrt_f60c1c() {
+ float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_f60c1c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ inverseSqrt_f60c1c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ inverseSqrt_f60c1c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.glsl
new file mode 100644
index 0000000..53b0371
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void inverseSqrt_f60c1c() {
+ vec2 res = vec2(1.0f);
+}
+
+vec4 vertex_main() {
+ inverseSqrt_f60c1c();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+void inverseSqrt_f60c1c() {
+ vec2 res = vec2(1.0f);
+}
+
+void fragment_main() {
+ inverseSqrt_f60c1c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void inverseSqrt_f60c1c() {
+ vec2 res = vec2(1.0f);
+}
+
+void compute_main() {
+ inverseSqrt_f60c1c();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.msl
new file mode 100644
index 0000000..093fa3d
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void inverseSqrt_f60c1c() {
+ float2 res = float2(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_f60c1c();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ inverseSqrt_f60c1c();
+ return;
+}
+
+kernel void compute_main() {
+ inverseSqrt_f60c1c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.spvasm
new file mode 100644
index 0000000..c4fc1cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %inverseSqrt_f60c1c "inverseSqrt_f60c1c"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantComposite %v2float %float_1 %float_1
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+%inverseSqrt_f60c1c = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v2float Function %18
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %inverseSqrt_f60c1c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %inverseSqrt_f60c1c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %inverseSqrt_f60c1c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.wgsl
new file mode 100644
index 0000000..e3b14d9
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/f60c1c.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn inverseSqrt_f60c1c() {
+ const arg_0 = vec2(1.0);
+ var res = inverseSqrt(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_f60c1c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ inverseSqrt_f60c1c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_f60c1c();
+}