Add const-eval for `atan`.
This CL adds const-eval for the `atan` operator.
Bug: tint:1581
Change-Id: I3d9b417e86af010dc2f18c4e0424ddf971d55984
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106844
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def
index ae18606..478be0d 100644
--- a/src/tint/intrinsics.def
+++ b/src/tint/intrinsics.def
@@ -419,8 +419,8 @@
fn asin<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
fn asinh<T: f32_f16>(T) -> T
fn asinh<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
-fn atan<T: f32_f16>(T) -> T
-fn atan<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
+@const fn atan<T: fa_f32_f16>(T) -> T
+@const fn atan<N: num, T: fa_f32_f16>(vec<N, T>) -> vec<N, T>
@const fn atan2<T: fa_f32_f16>(T, T) -> T
@const fn atan2<T: fa_f32_f16, N: num>(vec<N, T>, vec<N, T>) -> vec<N, T>
fn atanh<T: f32_f16>(T) -> T
diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc
index 0e0678a..4816cad 100644
--- a/src/tint/resolver/const_eval.cc
+++ b/src/tint/resolver/const_eval.cc
@@ -1527,6 +1527,18 @@
return r;
}
+ConstEval::Result ConstEval::atan(const sem::Type* ty,
+ utils::VectorRef<const sem::Constant*> args,
+ const Source&) {
+ auto transform = [&](const sem::Constant* c0) {
+ auto create = [&](auto i) {
+ return CreateElement(builder, c0->Type(), decltype(i)(std::atan(i.value)));
+ };
+ return Dispatch_fa_f32_f16(create, c0);
+ };
+ return TransformElements(builder, ty, transform, args[0]);
+}
+
ConstEval::Result ConstEval::atan2(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source&) {
diff --git a/src/tint/resolver/const_eval.h b/src/tint/resolver/const_eval.h
index 18f1374..fe292fc 100644
--- a/src/tint/resolver/const_eval.h
+++ b/src/tint/resolver/const_eval.h
@@ -377,6 +377,15 @@
// Builtins
////////////////////////////////////////////////////////////////////////////
+ /// atan builtin
+ /// @param ty the expression type
+ /// @param args the input arguments
+ /// @param source the source location of the conversion
+ /// @return the result value, or null if the value cannot be calculated
+ Result atan(const sem::Type* ty,
+ utils::VectorRef<const sem::Constant*> args,
+ const Source& source);
+
/// atan2 builtin
/// @param ty the expression type
/// @param args the input arguments
diff --git a/src/tint/resolver/const_eval_builtin_test.cc b/src/tint/resolver/const_eval_builtin_test.cc
index 86223ba..7afc971 100644
--- a/src/tint/resolver/const_eval_builtin_test.cc
+++ b/src/tint/resolver/const_eval_builtin_test.cc
@@ -220,6 +220,46 @@
Atan2Cases<f32, false>(),
Atan2Cases<f16, false>()))));
+template <typename T, bool finite_only>
+std::vector<Case> AtanCases() {
+ std::vector<Case> cases = {
+ C({T(1.0)}, kPiOver4<T>).FloatComp(),
+ C({-T(1.0)}, -kPiOver4<T>).FloatComp(),
+
+ // If i is +/-0, +/-0 is returned
+ C({T(0.0)}, T(0.0)).PosOrNeg(),
+
+ // Vector tests
+ C({Vec(T(0.0), T(1.0), -T(1.0))}, Vec(T(0.0), kPiOver4<T>, -kPiOver4<T>)).FloatComp(),
+ };
+
+ if constexpr (!finite_only) {
+ std::vector<Case> non_finite_cases = {
+ // If i is +/-INF, +/-PI/2 is returned
+ C({T::Inf()}, kPiOver2<T>).PosOrNeg().FloatComp(),
+ C({-T::Inf()}, -kPiOver2<T>).FloatComp(),
+
+ // If i is NaN, NaN is returned
+ C({T::NaN()}, T::NaN()),
+
+ // Vector tests
+ C({Vec(T::Inf(), -T::Inf(), T::Inf(), -T::Inf())}, //
+ Vec(kPiOver2<T>, -kPiOver2<T>, kPiOver2<T>, -kPiOver2<T>))
+ .FloatComp(),
+ };
+ cases = Concat(cases, non_finite_cases);
+ }
+
+ return cases;
+}
+INSTANTIATE_TEST_SUITE_P( //
+ Atan,
+ ResolverConstEvalBuiltinTest,
+ testing::Combine(testing::Values(sem::BuiltinType::kAtan),
+ testing::ValuesIn(Concat(AtanCases<AFloat, true>(), //
+ AtanCases<f32, false>(),
+ AtanCases<f16, false>()))));
+
template <typename T>
std::vector<Case> ClampCases() {
return {
diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl
index 268e332..657b44a 100644
--- a/src/tint/resolver/intrinsic_table.inl
+++ b/src/tint/resolver/intrinsic_table.inl
@@ -12255,24 +12255,24 @@
/* num parameters */ 1,
/* num template types */ 1,
/* num template numbers */ 0,
- /* template types */ &kTemplateTypes[13],
+ /* template types */ &kTemplateTypes[12],
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[984],
/* return matcher indices */ &kMatcherIndices[1],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* const eval */ nullptr,
+ /* const eval */ &ConstEval::atan,
},
{
/* [333] */
/* num parameters */ 1,
/* num template types */ 1,
/* num template numbers */ 1,
- /* template types */ &kTemplateTypes[13],
+ /* template types */ &kTemplateTypes[12],
/* template numbers */ &kTemplateNumbers[5],
/* parameters */ &kParameters[973],
/* return matcher indices */ &kMatcherIndices[30],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* const eval */ nullptr,
+ /* const eval */ &ConstEval::atan,
},
{
/* [334] */
@@ -13978,8 +13978,8 @@
},
{
/* [8] */
- /* fn atan<T : f32_f16>(T) -> T */
- /* fn atan<N : num, T : f32_f16>(vec<N, T>) -> vec<N, T> */
+ /* fn atan<T : fa_f32_f16>(T) -> T */
+ /* fn atan<N : num, T : fa_f32_f16>(vec<N, T>) -> vec<N, T> */
/* num overloads */ 2,
/* overloads */ &kOverloads[332],
},
diff --git a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.dxc.hlsl
index 4ef60d4..41818f4 100644
--- a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void atan_02979a() {
- float res = atan(1.0f);
+ float res = 0.785398185f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.fxc.hlsl
index 4ef60d4..41818f4 100644
--- a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void atan_02979a() {
- float res = atan(1.0f);
+ float res = 0.785398185f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.glsl
index ba9c6a0..46783bc 100644
--- a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void atan_02979a() {
- float res = atan(1.0f);
+ float res = 0.785398185f;
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void atan_02979a() {
- float res = atan(1.0f);
+ float res = 0.785398185f;
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void atan_02979a() {
- float res = atan(1.0f);
+ float res = 0.785398185f;
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.msl
index a4b9181..39b894b 100644
--- a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void atan_02979a() {
- float res = atan(1.0f);
+ float res = 0.785398185f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.spvasm
index 301e926..e1d8202 100644
--- a/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atan/02979a.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 30
; Schema: 0
OpCapability Shader
- %14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -31,35 +30,35 @@
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
- %float_1 = OpConstant %float 1
+%float_0_785398185 = OpConstant %float 0.785398185
%_ptr_Function_float = OpTypePointer Function %float
- %18 = OpTypeFunction %v4float
+ %16 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%atan_02979a = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
- %13 = OpExtInst %float %14 Atan %float_1
- OpStore %res %13
+ OpStore %res %float_0_785398185
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %18
- %20 = OpLabel
- %21 = OpFunctionCall %void %atan_02979a
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %atan_02979a
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %23 = OpLabel
- %24 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %24
+ %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
- %26 = OpLabel
- %27 = OpFunctionCall %void %atan_02979a
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %atan_02979a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %atan_02979a
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %atan_02979a
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.dxc.hlsl
index 32017a8..db14b48 100644
--- a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void atan_19faea() {
- vector<float16_t, 4> res = atan((float16_t(0.0h)).xxxx);
+ vector<float16_t, 4> res = (float16_t(0.0h)).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.glsl
index 13299d8..ad63e47 100644
--- a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void atan_19faea() {
- f16vec4 res = atan(f16vec4(0.0hf));
+ f16vec4 res = f16vec4(0.0hf);
}
vec4 vertex_main() {
@@ -23,7 +23,7 @@
precision mediump float;
void atan_19faea() {
- f16vec4 res = atan(f16vec4(0.0hf));
+ f16vec4 res = f16vec4(0.0hf);
}
void fragment_main() {
@@ -38,7 +38,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void atan_19faea() {
- f16vec4 res = atan(f16vec4(0.0hf));
+ f16vec4 res = f16vec4(0.0hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.msl
index a52ea2c..183c560 100644
--- a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void atan_19faea() {
- half4 res = atan(half4(0.0h));
+ half4 res = half4(0.0h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.spvasm
index 38b784b..4fa1e97 100644
--- a/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atan/19faea.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %16 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -37,36 +36,35 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
- %17 = OpConstantNull %v4half
+ %15 = OpConstantNull %v4half
%_ptr_Function_v4half = OpTypePointer Function %v4half
- %20 = OpTypeFunction %v4float
+ %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%atan_19faea = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v4half Function %17
- %13 = OpExtInst %v4half %16 Atan %17
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v4half Function %15
+ OpStore %res %15
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %20
- %22 = OpLabel
- %23 = OpFunctionCall %void %atan_19faea
+%vertex_main_inner = OpFunction %v4float None %18
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %atan_19faea
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %25 = OpLabel
- %26 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %26
+ %23 = OpLabel
+ %24 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %atan_19faea
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %atan_19faea
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %atan_19faea
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %atan_19faea
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.dxc.hlsl
index a1e7df0..04d8dbe 100644
--- a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void atan_1e1764() {
- vector<float16_t, 2> res = atan((float16_t(0.0h)).xx);
+ vector<float16_t, 2> res = (float16_t(0.0h)).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.glsl
index 5e93d9a..f0bca04 100644
--- a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void atan_1e1764() {
- f16vec2 res = atan(f16vec2(0.0hf));
+ f16vec2 res = f16vec2(0.0hf);
}
vec4 vertex_main() {
@@ -23,7 +23,7 @@
precision mediump float;
void atan_1e1764() {
- f16vec2 res = atan(f16vec2(0.0hf));
+ f16vec2 res = f16vec2(0.0hf);
}
void fragment_main() {
@@ -38,7 +38,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void atan_1e1764() {
- f16vec2 res = atan(f16vec2(0.0hf));
+ f16vec2 res = f16vec2(0.0hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.msl
index e16428d..ed6033e 100644
--- a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void atan_1e1764() {
- half2 res = atan(half2(0.0h));
+ half2 res = half2(0.0h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.spvasm
index f7715a7..e51b794 100644
--- a/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atan/1e1764.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %16 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -37,36 +36,35 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
- %17 = OpConstantNull %v2half
+ %15 = OpConstantNull %v2half
%_ptr_Function_v2half = OpTypePointer Function %v2half
- %20 = OpTypeFunction %v4float
+ %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%atan_1e1764 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v2half Function %17
- %13 = OpExtInst %v2half %16 Atan %17
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v2half Function %15
+ OpStore %res %15
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %20
- %22 = OpLabel
- %23 = OpFunctionCall %void %atan_1e1764
+%vertex_main_inner = OpFunction %v4float None %18
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %atan_1e1764
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %25 = OpLabel
- %26 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %26
+ %23 = OpLabel
+ %24 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %atan_1e1764
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %atan_1e1764
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %atan_1e1764
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %atan_1e1764
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.dxc.hlsl
index 14fc178..e5151fa 100644
--- a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void atan_331e6d() {
- float3 res = atan((1.0f).xxx);
+ float3 res = (0.785398185f).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.fxc.hlsl
index 14fc178..e5151fa 100644
--- a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void atan_331e6d() {
- float3 res = atan((1.0f).xxx);
+ float3 res = (0.785398185f).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.glsl
index 373702b..646e9e3 100644
--- a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void atan_331e6d() {
- vec3 res = atan(vec3(1.0f));
+ vec3 res = vec3(0.785398185f);
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void atan_331e6d() {
- vec3 res = atan(vec3(1.0f));
+ vec3 res = vec3(0.785398185f);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void atan_331e6d() {
- vec3 res = atan(vec3(1.0f));
+ vec3 res = vec3(0.785398185f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.msl
index a05319c..fc6b5b9 100644
--- a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void atan_331e6d() {
- float3 res = atan(float3(1.0f));
+ float3 res = float3(0.785398185f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.spvasm
index 186619c..085901d 100644
--- a/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atan/331e6d.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 33
; Schema: 0
OpCapability Shader
- %15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -32,37 +31,37 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
- %float_1 = OpConstant %float 1
- %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+%float_0_785398185 = OpConstant %float 0.785398185
+ %15 = OpConstantComposite %v3float %float_0_785398185 %float_0_785398185 %float_0_785398185
%_ptr_Function_v3float = OpTypePointer Function %v3float
- %20 = OpConstantNull %v3float
- %21 = OpTypeFunction %v4float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%atan_331e6d = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v3float Function %20
- %13 = OpExtInst %v3float %15 Atan %17
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v3float Function %18
+ OpStore %res %15
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %21
- %23 = OpLabel
- %24 = OpFunctionCall %void %atan_331e6d
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %atan_331e6d
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %26 = OpLabel
- %27 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %27
+ %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
- %29 = OpLabel
- %30 = OpFunctionCall %void %atan_331e6d
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %atan_331e6d
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %atan_331e6d
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %atan_331e6d
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl
new file mode 100644
index 0000000..1b43620
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl
@@ -0,0 +1,43 @@
+// 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 atan(vec<2, fa>) -> vec<2, fa>
+fn atan_5ca7b8() {
+ var res = atan(vec2(1));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_5ca7b8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_5ca7b8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_5ca7b8();
+}
diff --git a/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..bea5d88
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atan_5ca7b8() {
+ float2 res = (0.785398185f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_5ca7b8();
+ 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() {
+ atan_5ca7b8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_5ca7b8();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..bea5d88
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atan_5ca7b8() {
+ float2 res = (0.785398185f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_5ca7b8();
+ 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() {
+ atan_5ca7b8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_5ca7b8();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.glsl
new file mode 100644
index 0000000..e816df0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atan_5ca7b8() {
+ vec2 res = vec2(0.785398185f);
+}
+
+vec4 vertex_main() {
+ atan_5ca7b8();
+ 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 atan_5ca7b8() {
+ vec2 res = vec2(0.785398185f);
+}
+
+void fragment_main() {
+ atan_5ca7b8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan_5ca7b8() {
+ vec2 res = vec2(0.785398185f);
+}
+
+void compute_main() {
+ atan_5ca7b8();
+}
+
+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/literal/atan/5ca7b8.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.msl
new file mode 100644
index 0000000..d2a1cc8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan_5ca7b8() {
+ float2 res = float2(0.785398185f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan_5ca7b8();
+ 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() {
+ atan_5ca7b8();
+ return;
+}
+
+kernel void compute_main() {
+ atan_5ca7b8();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.spvasm
new file mode 100644
index 0000000..7d8be76
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.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 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 %atan_5ca7b8 "atan_5ca7b8"
+ 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_0_785398185 = OpConstant %float 0.785398185
+ %15 = OpConstantComposite %v2float %float_0_785398185 %float_0_785398185
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan_5ca7b8 = 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 %atan_5ca7b8
+ 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
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %atan_5ca7b8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %atan_5ca7b8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.wgsl
new file mode 100644
index 0000000..d073436
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/5ca7b8.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn atan_5ca7b8() {
+ var res = atan(vec2(1));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_5ca7b8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_5ca7b8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_5ca7b8();
+}
diff --git a/test/tint/builtins/gen/literal/atan/749e1b.wgsl b/test/tint/builtins/gen/literal/atan/749e1b.wgsl
new file mode 100644
index 0000000..99655a7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/749e1b.wgsl
@@ -0,0 +1,43 @@
+// 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 atan(vec<3, fa>) -> vec<3, fa>
+fn atan_749e1b() {
+ var res = atan(vec3(1));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_749e1b();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_749e1b();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_749e1b();
+}
diff --git a/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..f7c75ea
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atan_749e1b() {
+ float3 res = (0.785398185f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_749e1b();
+ 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() {
+ atan_749e1b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_749e1b();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..f7c75ea
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atan_749e1b() {
+ float3 res = (0.785398185f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_749e1b();
+ 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() {
+ atan_749e1b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_749e1b();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.glsl
new file mode 100644
index 0000000..e596e37
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atan_749e1b() {
+ vec3 res = vec3(0.785398185f);
+}
+
+vec4 vertex_main() {
+ atan_749e1b();
+ 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 atan_749e1b() {
+ vec3 res = vec3(0.785398185f);
+}
+
+void fragment_main() {
+ atan_749e1b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan_749e1b() {
+ vec3 res = vec3(0.785398185f);
+}
+
+void compute_main() {
+ atan_749e1b();
+}
+
+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/literal/atan/749e1b.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.msl
new file mode 100644
index 0000000..4ee66a7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan_749e1b() {
+ float3 res = float3(0.785398185f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan_749e1b();
+ 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() {
+ atan_749e1b();
+ return;
+}
+
+kernel void compute_main() {
+ atan_749e1b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.spvasm
new file mode 100644
index 0000000..853697e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/749e1b.wgsl.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 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 %atan_749e1b "atan_749e1b"
+ 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_0_785398185 = OpConstant %float 0.785398185
+ %15 = OpConstantComposite %v3float %float_0_785398185 %float_0_785398185 %float_0_785398185
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan_749e1b = 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 %atan_749e1b
+ 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
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %atan_749e1b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %atan_749e1b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.wgsl
new file mode 100644
index 0000000..bd23c31
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/749e1b.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn atan_749e1b() {
+ var res = atan(vec3(1));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_749e1b();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_749e1b();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_749e1b();
+}
diff --git a/test/tint/builtins/gen/literal/atan/7a2a75.wgsl b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl
new file mode 100644
index 0000000..51eddfb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl
@@ -0,0 +1,43 @@
+// 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 atan(fa) -> fa
+fn atan_7a2a75() {
+ var res = atan(1);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_7a2a75();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_7a2a75();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_7a2a75();
+}
diff --git a/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..173246a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atan_7a2a75() {
+ float res = 0.785398185f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_7a2a75();
+ 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() {
+ atan_7a2a75();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_7a2a75();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..173246a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atan_7a2a75() {
+ float res = 0.785398185f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_7a2a75();
+ 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() {
+ atan_7a2a75();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_7a2a75();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.glsl
new file mode 100644
index 0000000..952e56b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atan_7a2a75() {
+ float res = 0.785398185f;
+}
+
+vec4 vertex_main() {
+ atan_7a2a75();
+ 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 atan_7a2a75() {
+ float res = 0.785398185f;
+}
+
+void fragment_main() {
+ atan_7a2a75();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan_7a2a75() {
+ float res = 0.785398185f;
+}
+
+void compute_main() {
+ atan_7a2a75();
+}
+
+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/literal/atan/7a2a75.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.msl
new file mode 100644
index 0000000..12934a2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan_7a2a75() {
+ float res = 0.785398185f;
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan_7a2a75();
+ 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() {
+ atan_7a2a75();
+ return;
+}
+
+kernel void compute_main() {
+ atan_7a2a75();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.spvasm
new file mode 100644
index 0000000..1d57880
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/7a2a75.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 %atan_7a2a75 "atan_7a2a75"
+ 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_0_785398185 = OpConstant %float 0.785398185
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan_7a2a75 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %res %float_0_785398185
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %atan_7a2a75
+ 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
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %atan_7a2a75
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %atan_7a2a75
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.wgsl
new file mode 100644
index 0000000..da9a954
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/7a2a75.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn atan_7a2a75() {
+ var res = atan(1);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_7a2a75();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_7a2a75();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_7a2a75();
+}
diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.dxc.hlsl
index 3e5b84f..913e3e2 100644
--- a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void atan_a5f421() {
- vector<float16_t, 3> res = atan((float16_t(0.0h)).xxx);
+ vector<float16_t, 3> res = (float16_t(0.0h)).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.glsl
index 6d93eef..ced4a20 100644
--- a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void atan_a5f421() {
- f16vec3 res = atan(f16vec3(0.0hf));
+ f16vec3 res = f16vec3(0.0hf);
}
vec4 vertex_main() {
@@ -23,7 +23,7 @@
precision mediump float;
void atan_a5f421() {
- f16vec3 res = atan(f16vec3(0.0hf));
+ f16vec3 res = f16vec3(0.0hf);
}
void fragment_main() {
@@ -38,7 +38,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void atan_a5f421() {
- f16vec3 res = atan(f16vec3(0.0hf));
+ f16vec3 res = f16vec3(0.0hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.msl
index 66c582a..fd9e130 100644
--- a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void atan_a5f421() {
- half3 res = atan(half3(0.0h));
+ half3 res = half3(0.0h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.spvasm
index fa62fa2..8464422 100644
--- a/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atan/a5f421.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %16 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -37,36 +36,35 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
- %17 = OpConstantNull %v3half
+ %15 = OpConstantNull %v3half
%_ptr_Function_v3half = OpTypePointer Function %v3half
- %20 = OpTypeFunction %v4float
+ %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%atan_a5f421 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v3half Function %17
- %13 = OpExtInst %v3half %16 Atan %17
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v3half Function %15
+ OpStore %res %15
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %20
- %22 = OpLabel
- %23 = OpFunctionCall %void %atan_a5f421
+%vertex_main_inner = OpFunction %v4float None %18
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %atan_a5f421
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %25 = OpLabel
- %26 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %26
+ %23 = OpLabel
+ %24 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %atan_a5f421
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %atan_a5f421
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %atan_a5f421
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %atan_a5f421
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.dxc.hlsl
index b97a99c..c68aeb5 100644
--- a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void atan_a7ba61() {
- float16_t res = atan(float16_t(0.0h));
+ float16_t res = float16_t(0.0h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.glsl
index d2732b2..d6262bd 100644
--- a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void atan_a7ba61() {
- float16_t res = atan(0.0hf);
+ float16_t res = 0.0hf;
}
vec4 vertex_main() {
@@ -23,7 +23,7 @@
precision mediump float;
void atan_a7ba61() {
- float16_t res = atan(0.0hf);
+ float16_t res = 0.0hf;
}
void fragment_main() {
@@ -38,7 +38,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void atan_a7ba61() {
- float16_t res = atan(0.0hf);
+ float16_t res = 0.0hf;
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.msl
index b225ca0..c35f48f 100644
--- a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void atan_a7ba61() {
- half res = atan(0.0h);
+ half res = 0.0h;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.spvasm
index 45a9b3d..7ff9f39 100644
--- a/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atan/a7ba61.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 33
+; Bound: 31
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -36,36 +35,35 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
- %16 = OpConstantNull %half
+ %14 = OpConstantNull %half
%_ptr_Function_half = OpTypePointer Function %half
- %19 = OpTypeFunction %v4float
+ %17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%atan_a7ba61 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_half Function %16
- %13 = OpExtInst %half %15 Atan %16
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_half Function %14
+ OpStore %res %14
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %19
- %21 = OpLabel
- %22 = OpFunctionCall %void %atan_a7ba61
+%vertex_main_inner = OpFunction %v4float None %17
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %atan_a7ba61
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %24 = OpLabel
- %25 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %25
+ %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
- %28 = OpLabel
- %29 = OpFunctionCall %void %atan_a7ba61
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %atan_a7ba61
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %31 = OpLabel
- %32 = OpFunctionCall %void %atan_a7ba61
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %atan_a7ba61
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.dxc.hlsl
index 3d5dd23..f007a49 100644
--- a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void atan_a8b696() {
- float4 res = atan((1.0f).xxxx);
+ float4 res = (0.785398185f).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.fxc.hlsl
index 3d5dd23..f007a49 100644
--- a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void atan_a8b696() {
- float4 res = atan((1.0f).xxxx);
+ float4 res = (0.785398185f).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.glsl
index a0d75a1..d04359c 100644
--- a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void atan_a8b696() {
- vec4 res = atan(vec4(1.0f));
+ vec4 res = vec4(0.785398185f);
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void atan_a8b696() {
- vec4 res = atan(vec4(1.0f));
+ vec4 res = vec4(0.785398185f);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void atan_a8b696() {
- vec4 res = atan(vec4(1.0f));
+ vec4 res = vec4(0.785398185f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.msl
index 35885ed..c7e812e 100644
--- a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void atan_a8b696() {
- float4 res = atan(float4(1.0f));
+ float4 res = float4(0.785398185f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.spvasm
index 10cdf7b..967379c 100644
--- a/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atan/a8b696.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 31
; Schema: 0
OpCapability Shader
- %14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -31,36 +30,36 @@
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
- %float_1 = OpConstant %float 1
- %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+%float_0_785398185 = OpConstant %float 0.785398185
+ %14 = OpConstantComposite %v4float %float_0_785398185 %float_0_785398185 %float_0_785398185 %float_0_785398185
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %19 = OpTypeFunction %v4float
+ %17 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%atan_a8b696 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
- %13 = OpExtInst %v4float %14 Atan %16
- OpStore %res %13
+ OpStore %res %14
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %19
- %21 = OpLabel
- %22 = OpFunctionCall %void %atan_a8b696
+%vertex_main_inner = OpFunction %v4float None %17
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %atan_a8b696
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %24 = OpLabel
- %25 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %25
+ %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
- %27 = OpLabel
- %28 = OpFunctionCall %void %atan_a8b696
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %atan_a8b696
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %30 = OpLabel
- %31 = OpFunctionCall %void %atan_a8b696
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %atan_a8b696
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.dxc.hlsl
index 7b94859..96fe34b 100644
--- a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void atan_ad96e4() {
- float2 res = atan((1.0f).xx);
+ float2 res = (0.785398185f).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.fxc.hlsl
index 7b94859..96fe34b 100644
--- a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void atan_ad96e4() {
- float2 res = atan((1.0f).xx);
+ float2 res = (0.785398185f).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.glsl
index 640b7a3..eb84cd8 100644
--- a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void atan_ad96e4() {
- vec2 res = atan(vec2(1.0f));
+ vec2 res = vec2(0.785398185f);
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void atan_ad96e4() {
- vec2 res = atan(vec2(1.0f));
+ vec2 res = vec2(0.785398185f);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void atan_ad96e4() {
- vec2 res = atan(vec2(1.0f));
+ vec2 res = vec2(0.785398185f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.msl
index d3f11d5..ce75560 100644
--- a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void atan_ad96e4() {
- float2 res = atan(float2(1.0f));
+ float2 res = float2(0.785398185f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.spvasm
index 3bc1779..b012aba 100644
--- a/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/atan/ad96e4.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 33
; Schema: 0
OpCapability Shader
- %15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -32,37 +31,37 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%v2float = OpTypeVector %float 2
- %float_1 = OpConstant %float 1
- %17 = OpConstantComposite %v2float %float_1 %float_1
+%float_0_785398185 = OpConstant %float 0.785398185
+ %15 = OpConstantComposite %v2float %float_0_785398185 %float_0_785398185
%_ptr_Function_v2float = OpTypePointer Function %v2float
- %20 = OpConstantNull %v2float
- %21 = OpTypeFunction %v4float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%atan_ad96e4 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v2float Function %20
- %13 = OpExtInst %v2float %15 Atan %17
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v2float Function %18
+ OpStore %res %15
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %21
- %23 = OpLabel
- %24 = OpFunctionCall %void %atan_ad96e4
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %atan_ad96e4
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %26 = OpLabel
- %27 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %27
+ %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
- %29 = OpLabel
- %30 = OpFunctionCall %void %atan_ad96e4
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %atan_ad96e4
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %atan_ad96e4
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %atan_ad96e4
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atan/d17fb2.wgsl b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl
new file mode 100644
index 0000000..9b46759
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl
@@ -0,0 +1,43 @@
+// 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 atan(vec<4, fa>) -> vec<4, fa>
+fn atan_d17fb2() {
+ var res = atan(vec4(1));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_d17fb2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_d17fb2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_d17fb2();
+}
diff --git a/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..96e0256
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atan_d17fb2() {
+ float4 res = (0.785398185f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_d17fb2();
+ 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() {
+ atan_d17fb2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_d17fb2();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..96e0256
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atan_d17fb2() {
+ float4 res = (0.785398185f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_d17fb2();
+ 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() {
+ atan_d17fb2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_d17fb2();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.glsl
new file mode 100644
index 0000000..93ead11
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atan_d17fb2() {
+ vec4 res = vec4(0.785398185f);
+}
+
+vec4 vertex_main() {
+ atan_d17fb2();
+ 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 atan_d17fb2() {
+ vec4 res = vec4(0.785398185f);
+}
+
+void fragment_main() {
+ atan_d17fb2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan_d17fb2() {
+ vec4 res = vec4(0.785398185f);
+}
+
+void compute_main() {
+ atan_d17fb2();
+}
+
+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/literal/atan/d17fb2.wgsl.expected.msl b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.msl
new file mode 100644
index 0000000..d74bfda
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan_d17fb2() {
+ float4 res = float4(0.785398185f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan_d17fb2();
+ 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() {
+ atan_d17fb2();
+ return;
+}
+
+kernel void compute_main() {
+ atan_d17fb2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.spvasm
new file mode 100644
index 0000000..61302f7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.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 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 %atan_d17fb2 "atan_d17fb2"
+ 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_0_785398185 = OpConstant %float 0.785398185
+ %14 = OpConstantComposite %v4float %float_0_785398185 %float_0_785398185 %float_0_785398185 %float_0_785398185
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %17 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan_d17fb2 = 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 %atan_d17fb2
+ 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
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %atan_d17fb2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %atan_d17fb2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.wgsl
new file mode 100644
index 0000000..cc6d644
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atan/d17fb2.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn atan_d17fb2() {
+ var res = atan(vec4(1));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_d17fb2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_d17fb2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_d17fb2();
+}
diff --git a/test/tint/builtins/gen/var/atan/5ca7b8.wgsl b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl
new file mode 100644
index 0000000..8d7f504
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/5ca7b8.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 atan(vec<2, fa>) -> vec<2, fa>
+fn atan_5ca7b8() {
+ const arg_0 = vec2(1);
+ var res = atan(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_5ca7b8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_5ca7b8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_5ca7b8();
+}
diff --git a/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..bea5d88
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atan_5ca7b8() {
+ float2 res = (0.785398185f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_5ca7b8();
+ 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() {
+ atan_5ca7b8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_5ca7b8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..bea5d88
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atan_5ca7b8() {
+ float2 res = (0.785398185f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_5ca7b8();
+ 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() {
+ atan_5ca7b8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_5ca7b8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.glsl
new file mode 100644
index 0000000..e816df0
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atan_5ca7b8() {
+ vec2 res = vec2(0.785398185f);
+}
+
+vec4 vertex_main() {
+ atan_5ca7b8();
+ 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 atan_5ca7b8() {
+ vec2 res = vec2(0.785398185f);
+}
+
+void fragment_main() {
+ atan_5ca7b8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan_5ca7b8() {
+ vec2 res = vec2(0.785398185f);
+}
+
+void compute_main() {
+ atan_5ca7b8();
+}
+
+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/atan/5ca7b8.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.msl
new file mode 100644
index 0000000..d2a1cc8
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan_5ca7b8() {
+ float2 res = float2(0.785398185f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan_5ca7b8();
+ 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() {
+ atan_5ca7b8();
+ return;
+}
+
+kernel void compute_main() {
+ atan_5ca7b8();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.spvasm
new file mode 100644
index 0000000..7d8be76
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.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 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 %atan_5ca7b8 "atan_5ca7b8"
+ 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_0_785398185 = OpConstant %float 0.785398185
+ %15 = OpConstantComposite %v2float %float_0_785398185 %float_0_785398185
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan_5ca7b8 = 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 %atan_5ca7b8
+ 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
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %atan_5ca7b8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %atan_5ca7b8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.wgsl
new file mode 100644
index 0000000..b51805a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/5ca7b8.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn atan_5ca7b8() {
+ const arg_0 = vec2(1);
+ var res = atan(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_5ca7b8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_5ca7b8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_5ca7b8();
+}
diff --git a/test/tint/builtins/gen/var/atan/749e1b.wgsl b/test/tint/builtins/gen/var/atan/749e1b.wgsl
new file mode 100644
index 0000000..954592f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/749e1b.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 atan(vec<3, fa>) -> vec<3, fa>
+fn atan_749e1b() {
+ const arg_0 = vec3(1);
+ var res = atan(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_749e1b();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_749e1b();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_749e1b();
+}
diff --git a/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..f7c75ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atan_749e1b() {
+ float3 res = (0.785398185f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_749e1b();
+ 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() {
+ atan_749e1b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_749e1b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..f7c75ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atan_749e1b() {
+ float3 res = (0.785398185f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_749e1b();
+ 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() {
+ atan_749e1b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_749e1b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.glsl
new file mode 100644
index 0000000..e596e37
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atan_749e1b() {
+ vec3 res = vec3(0.785398185f);
+}
+
+vec4 vertex_main() {
+ atan_749e1b();
+ 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 atan_749e1b() {
+ vec3 res = vec3(0.785398185f);
+}
+
+void fragment_main() {
+ atan_749e1b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan_749e1b() {
+ vec3 res = vec3(0.785398185f);
+}
+
+void compute_main() {
+ atan_749e1b();
+}
+
+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/atan/749e1b.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.msl
new file mode 100644
index 0000000..4ee66a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan_749e1b() {
+ float3 res = float3(0.785398185f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan_749e1b();
+ 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() {
+ atan_749e1b();
+ return;
+}
+
+kernel void compute_main() {
+ atan_749e1b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.spvasm
new file mode 100644
index 0000000..853697e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/749e1b.wgsl.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 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 %atan_749e1b "atan_749e1b"
+ 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_0_785398185 = OpConstant %float 0.785398185
+ %15 = OpConstantComposite %v3float %float_0_785398185 %float_0_785398185 %float_0_785398185
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan_749e1b = 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 %atan_749e1b
+ 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
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %atan_749e1b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %atan_749e1b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.wgsl
new file mode 100644
index 0000000..5dc2aff
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/749e1b.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn atan_749e1b() {
+ const arg_0 = vec3(1);
+ var res = atan(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_749e1b();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_749e1b();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_749e1b();
+}
diff --git a/test/tint/builtins/gen/var/atan/7a2a75.wgsl b/test/tint/builtins/gen/var/atan/7a2a75.wgsl
new file mode 100644
index 0000000..be5313d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/7a2a75.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 atan(fa) -> fa
+fn atan_7a2a75() {
+ const arg_0 = 1;
+ var res = atan(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_7a2a75();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_7a2a75();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_7a2a75();
+}
diff --git a/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..173246a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atan_7a2a75() {
+ float res = 0.785398185f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_7a2a75();
+ 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() {
+ atan_7a2a75();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_7a2a75();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..173246a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atan_7a2a75() {
+ float res = 0.785398185f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_7a2a75();
+ 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() {
+ atan_7a2a75();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_7a2a75();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.glsl
new file mode 100644
index 0000000..952e56b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atan_7a2a75() {
+ float res = 0.785398185f;
+}
+
+vec4 vertex_main() {
+ atan_7a2a75();
+ 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 atan_7a2a75() {
+ float res = 0.785398185f;
+}
+
+void fragment_main() {
+ atan_7a2a75();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan_7a2a75() {
+ float res = 0.785398185f;
+}
+
+void compute_main() {
+ atan_7a2a75();
+}
+
+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/atan/7a2a75.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.msl
new file mode 100644
index 0000000..12934a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan_7a2a75() {
+ float res = 0.785398185f;
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan_7a2a75();
+ 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() {
+ atan_7a2a75();
+ return;
+}
+
+kernel void compute_main() {
+ atan_7a2a75();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.spvasm
new file mode 100644
index 0000000..1d57880
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/7a2a75.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 %atan_7a2a75 "atan_7a2a75"
+ 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_0_785398185 = OpConstant %float 0.785398185
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan_7a2a75 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %res %float_0_785398185
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %atan_7a2a75
+ 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
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %atan_7a2a75
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %atan_7a2a75
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.wgsl
new file mode 100644
index 0000000..b9b8159
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/7a2a75.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn atan_7a2a75() {
+ const arg_0 = 1;
+ var res = atan(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_7a2a75();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_7a2a75();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_7a2a75();
+}
diff --git a/test/tint/builtins/gen/var/atan/d17fb2.wgsl b/test/tint/builtins/gen/var/atan/d17fb2.wgsl
new file mode 100644
index 0000000..ac898e3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/d17fb2.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 atan(vec<4, fa>) -> vec<4, fa>
+fn atan_d17fb2() {
+ const arg_0 = vec4(1);
+ var res = atan(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_d17fb2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_d17fb2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_d17fb2();
+}
diff --git a/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..96e0256
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atan_d17fb2() {
+ float4 res = (0.785398185f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_d17fb2();
+ 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() {
+ atan_d17fb2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_d17fb2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..96e0256
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atan_d17fb2() {
+ float4 res = (0.785398185f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_d17fb2();
+ 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() {
+ atan_d17fb2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_d17fb2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.glsl
new file mode 100644
index 0000000..93ead11
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atan_d17fb2() {
+ vec4 res = vec4(0.785398185f);
+}
+
+vec4 vertex_main() {
+ atan_d17fb2();
+ 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 atan_d17fb2() {
+ vec4 res = vec4(0.785398185f);
+}
+
+void fragment_main() {
+ atan_d17fb2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan_d17fb2() {
+ vec4 res = vec4(0.785398185f);
+}
+
+void compute_main() {
+ atan_d17fb2();
+}
+
+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/atan/d17fb2.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.msl
new file mode 100644
index 0000000..d74bfda
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan_d17fb2() {
+ float4 res = float4(0.785398185f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan_d17fb2();
+ 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() {
+ atan_d17fb2();
+ return;
+}
+
+kernel void compute_main() {
+ atan_d17fb2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.spvasm
new file mode 100644
index 0000000..61302f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/d17fb2.wgsl.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 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 %atan_d17fb2 "atan_d17fb2"
+ 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_0_785398185 = OpConstant %float 0.785398185
+ %14 = OpConstantComposite %v4float %float_0_785398185 %float_0_785398185 %float_0_785398185 %float_0_785398185
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %17 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan_d17fb2 = 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 %atan_d17fb2
+ 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
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %atan_d17fb2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %atan_d17fb2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.wgsl
new file mode 100644
index 0000000..e625150
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/d17fb2.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn atan_d17fb2() {
+ const arg_0 = vec4(1);
+ var res = atan(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_d17fb2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ atan_d17fb2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ atan_d17fb2();
+}