Add const-eval for `atanh`.

This CL adds const-eval for the `atanh` operator.

Bug: tint:1581
Change-Id: I7d8989a348ad1d8ca463dae90233fd82d6faf2d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106849
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def
index 9718405..7bd16174 100644
--- a/src/tint/intrinsics.def
+++ b/src/tint/intrinsics.def
@@ -423,8 +423,8 @@
 @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>(@test_value(0.5) T) -> T
-fn atanh<N: num, T: f32_f16>(@test_value(0.5) vec<N, T>) -> vec<N, T>
+@const fn atanh<T: fa_f32_f16>(@test_value(0.5) T) -> T
+@const fn atanh<N: num, T: fa_f32_f16>(@test_value(0.5) vec<N, T>) -> vec<N, T>
 fn ceil<T: f32_f16>(T) -> T
 fn ceil<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
 @const fn clamp<T: fia_fiu32_f16>(T, T, T) -> T
diff --git a/src/tint/resolver/builtin_test.cc b/src/tint/resolver/builtin_test.cc
index b28521d..79eb075 100644
--- a/src/tint/resolver/builtin_test.cc
+++ b/src/tint/resolver/builtin_test.cc
@@ -278,7 +278,7 @@
 TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Scalar_f32) {
     auto param = GetParam();
 
-    auto* call = Call(param.name, 1_f);
+    auto* call = Call(param.name, 0.5_f);
     WrapInFunction(call);
 
     if (param.args_number == 1u) {
@@ -299,7 +299,7 @@
 TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Vector_f32) {
     auto param = GetParam();
 
-    auto* call = Call(param.name, vec3<f32>(1_f, 1_f, 3_f));
+    auto* call = Call(param.name, vec3<f32>(0.5_f, 0.5_f, 0.8_f));
     WrapInFunction(call);
 
     if (param.args_number == 1u) {
@@ -464,7 +464,7 @@
 
     Enable(ast::Extension::kF16);
 
-    auto* call = Call(param.name, 1_h);
+    auto* call = Call(param.name, 0.5_h);
     WrapInFunction(call);
 
     if (param.args_number == 1u) {
@@ -487,7 +487,7 @@
 
     Enable(ast::Extension::kF16);
 
-    auto* call = Call(param.name, vec3<f16>(1_h, 1_h, 3_h));
+    auto* call = Call(param.name, vec3<f16>(0.5_h, 0.5_h, 0.8_h));
     WrapInFunction(call);
 
     if (param.args_number == 1u) {
diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc
index 4816cad..85e68f6 100644
--- a/src/tint/resolver/const_eval.cc
+++ b/src/tint/resolver/const_eval.cc
@@ -1539,6 +1539,24 @@
     return TransformElements(builder, ty, transform, args[0]);
 }
 
+ConstEval::Result ConstEval::atanh(const sem::Type* ty,
+                                   utils::VectorRef<const sem::Constant*> args,
+                                   const Source& source) {
+    auto transform = [&](const sem::Constant* c0) {
+        auto create = [&](auto i) -> ImplResult {
+            using NumberT = decltype(i);
+            if (i.value <= NumberT(-1.0) || i.value >= NumberT(1.0)) {
+                AddError("atanh must be called with a value in the range (-1, 1)", source);
+                return utils::Failure;
+            }
+            return CreateElement(builder, c0->Type(), decltype(i)(std::atanh(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 fe292fc..04b4e95 100644
--- a/src/tint/resolver/const_eval.h
+++ b/src/tint/resolver/const_eval.h
@@ -386,6 +386,15 @@
                 utils::VectorRef<const sem::Constant*> args,
                 const Source& source);
 
+    /// atanh 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 atanh(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 5b21ee6..a55482e 100644
--- a/src/tint/resolver/const_eval_builtin_test.cc
+++ b/src/tint/resolver/const_eval_builtin_test.cc
@@ -90,9 +90,10 @@
     auto* expected_expr = expected->Expr(*this);
     GlobalConst("E", expected_expr);
 
-    EXPECT_TRUE(r()->Resolve()) << r()->error();
+    ASSERT_TRUE(r()->Resolve()) << r()->error();
 
     auto* sem = Sem().Get(expr);
+    ASSERT_NE(sem, nullptr);
     const sem::Constant* value = sem->ConstantValue();
     ASSERT_NE(value, nullptr);
     EXPECT_TYPE(value->Type(), sem->Type());
@@ -255,6 +256,68 @@
                      testing::ValuesIn(Concat(AtanCases<AFloat, true>(),  //
                                               AtanCases<f32, false>(),
                                               AtanCases<f16, false>()))));
+template <typename T, bool finite_only>
+std::vector<Case> AtanhCases() {
+    std::vector<Case> cases = {
+        // If i is +/-0, +/-0 is returned
+        C({T(0.0)}, T(0.0)).PosOrNeg(),
+
+        C({T(0.9)}, T(1.4722193)).FloatComp(),
+
+        // Vector tests
+        C({Vec(T(0.0), T(0.9), -T(0.9))}, Vec(T(0.0), T(1.4722193), -T(1.4722193))).FloatComp(),
+    };
+
+    ConcatIntoIf<!finite_only>(  //
+        cases, std::vector<Case>{
+                   // If i is NaN, NaN is returned
+                   C({T::NaN()}, T::NaN()),
+
+                   // Vector tests
+                   C({Vec(T::NaN(), T::NaN())}, Vec(T::NaN(), T::NaN())).FloatComp(),
+               });
+
+    return cases;
+}
+INSTANTIATE_TEST_SUITE_P(  //
+    Atanh,
+    ResolverConstEvalBuiltinTest,
+    testing::Combine(testing::Values(sem::BuiltinType::kAtanh),
+                     testing::ValuesIn(Concat(AtanhCases<AFloat, true>(),  //
+                                              AtanhCases<f32, false>(),
+                                              AtanhCases<f16, false>()))));
+
+TEST_F(ResolverConstEvalBuiltinTest, Atanh_OutsideRange_Positive) {
+    auto* expr = Call(Source{{12, 24}}, "atanh", Expr(1.0_a));
+
+    GlobalConst("C", expr);
+    EXPECT_FALSE(r()->Resolve());
+    EXPECT_EQ(r()->error(), "12:24 error: atanh must be called with a value in the range (-1, 1)");
+}
+
+TEST_F(ResolverConstEvalBuiltinTest, Atanh_OutsideRange_Negative) {
+    auto* expr = Call(Source{{12, 24}}, "atanh", Expr(-1.0_a));
+
+    GlobalConst("C", expr);
+    EXPECT_FALSE(r()->Resolve());
+    EXPECT_EQ(r()->error(), "12:24 error: atanh must be called with a value in the range (-1, 1)");
+}
+
+TEST_F(ResolverConstEvalBuiltinTest, Atanh_OutsideRange_Positive_INF) {
+    auto* expr = Call(Source{{12, 24}}, "atanh", Expr(f32::Inf()));
+
+    GlobalConst("C", expr);
+    EXPECT_FALSE(r()->Resolve());
+    EXPECT_EQ(r()->error(), "12:24 error: atanh must be called with a value in the range (-1, 1)");
+}
+
+TEST_F(ResolverConstEvalBuiltinTest, Atanh_OutsideRange_Negative_INF) {
+    auto* expr = Call(Source{{12, 24}}, "atanh", Expr(-f32::Inf()));
+
+    GlobalConst("C", expr);
+    EXPECT_FALSE(r()->Resolve());
+    EXPECT_EQ(r()->error(), "12:24 error: atanh must be called with a value in the range (-1, 1)");
+}
 
 template <typename T>
 std::vector<Case> ClampCases() {
diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl
index 139da44..0879cfc 100644
--- a/src/tint/resolver/intrinsic_table.inl
+++ b/src/tint/resolver/intrinsic_table.inl
@@ -12548,24 +12548,24 @@
     /* num parameters */ 1,
     /* num template types */ 1,
     /* num template numbers */ 0,
-    /* template types */ &kTemplateTypes[13],
+    /* template types */ &kTemplateTypes[16],
     /* template numbers */ &kTemplateNumbers[10],
     /* parameters */ &kParameters[970],
     /* return matcher indices */ &kMatcherIndices[1],
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
-    /* const eval */ nullptr,
+    /* const eval */ &ConstEval::atanh,
   },
   {
     /* [357] */
     /* num parameters */ 1,
     /* num template types */ 1,
     /* num template numbers */ 1,
-    /* template types */ &kTemplateTypes[13],
+    /* template types */ &kTemplateTypes[16],
     /* template numbers */ &kTemplateNumbers[5],
     /* parameters */ &kParameters[959],
     /* return matcher indices */ &kMatcherIndices[30],
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
-    /* const eval */ nullptr,
+    /* const eval */ &ConstEval::atanh,
   },
   {
     /* [358] */
@@ -13997,8 +13997,8 @@
   },
   {
     /* [10] */
-    /* fn atanh<T : f32_f16>(@test_value(0.5) T) -> T */
-    /* fn atanh<N : num, T : f32_f16>(@test_value(0.5) vec<N, T>) -> vec<N, T> */
+    /* fn atanh<T : fa_f32_f16>(@test_value(0.5) T) -> T */
+    /* fn atanh<N : num, T : fa_f32_f16>(@test_value(0.5) vec<N, T>) -> vec<N, T> */
     /* num overloads */ 2,
     /* overloads */ &kOverloads[356],
   },
diff --git a/src/tint/transform/builtin_polyfill_test.cc b/src/tint/transform/builtin_polyfill_test.cc
index 7c8440b..f59af03 100644
--- a/src/tint/transform/builtin_polyfill_test.cc
+++ b/src/tint/transform/builtin_polyfill_test.cc
@@ -233,7 +233,7 @@
 TEST_F(BuiltinPolyfillTest, ShouldRunAtanh) {
     auto* src = R"(
 fn f() {
-  atanh(1.0);
+  atanh(0.9f);
 }
 )";
 
@@ -246,7 +246,7 @@
 TEST_F(BuiltinPolyfillTest, Atanh_Full_f32) {
     auto* src = R"(
 fn f() {
-  let r : f32 = atanh(1234);
+  let r : f32 = atanh(0f);
 }
 )";
 
@@ -256,7 +256,7 @@
 }
 
 fn f() {
-  let r : f32 = tint_atanh(1234);
+  let r : f32 = tint_atanh(0.0f);
 }
 )";
 
@@ -268,7 +268,7 @@
 TEST_F(BuiltinPolyfillTest, Atanh_Full_vec3_f32) {
     auto* src = R"(
 fn f() {
-  let r : vec3<f32> = atanh(vec3<f32>(1234));
+  let r : vec3<f32> = atanh(vec3<f32>(0f));
 }
 )";
 
@@ -278,7 +278,7 @@
 }
 
 fn f() {
-  let r : vec3<f32> = tint_atanh(vec3<f32>(1234));
+  let r : vec3<f32> = tint_atanh(vec3<f32>(0.0f));
 }
 )";
 
@@ -290,7 +290,7 @@
 TEST_F(BuiltinPolyfillTest, Atanh_Range_f32) {
     auto* src = R"(
 fn f() {
-  let r : f32 = atanh(1234);
+  let r : f32 = atanh(0f);
 }
 )";
 
@@ -300,7 +300,7 @@
 }
 
 fn f() {
-  let r : f32 = tint_atanh(1234);
+  let r : f32 = tint_atanh(0.0f);
 }
 )";
 
@@ -312,17 +312,21 @@
 TEST_F(BuiltinPolyfillTest, Atanh_Range_vec3_f32) {
     auto* src = R"(
 fn f() {
-  let r : vec3<f32> = atanh(vec3<f32>(1234));
+  let r : vec3<f32> = atanh(vec3<f32>(0f));
 }
 )";
 
     auto* expect = R"(
+fn tint_atanh(x : vec3<f32>) -> vec3<f32> {
+  return select(atanh(x), vec3<f32>(0.0), (x >= vec3<f32>(1.0)));
+}
+
 fn f() {
-  let r : vec3<f32> = atanh(vec3<f32>(1234));
+  let r : vec3<f32> = tint_atanh(vec3<f32>(0.0f));
 }
 )";
 
-    auto got = Run<BuiltinPolyfill>(src, polyfillAcosh(Level::kRangeCheck));
+    auto got = Run<BuiltinPolyfill>(src, polyfillAtanh(Level::kRangeCheck));
 
     EXPECT_EQ(expect, str(got));
 }
diff --git a/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl b/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl
new file mode 100644
index 0000000..16d99bf
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/70d5bd.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 atanh(vec<2, fa>) -> vec<2, fa>
+fn atanh_70d5bd() {
+  var res = atanh(vec2(0.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_70d5bd();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_70d5bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_70d5bd();
+}
diff --git a/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..c309e30
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_70d5bd() {
+  float2 res = (0.549306154f).xx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_70d5bd();
+  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() {
+  atanh_70d5bd();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_70d5bd();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..c309e30
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_70d5bd() {
+  float2 res = (0.549306154f).xx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_70d5bd();
+  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() {
+  atanh_70d5bd();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_70d5bd();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.glsl
new file mode 100644
index 0000000..4810f62
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atanh_70d5bd() {
+  vec2 res = vec2(0.549306154f);
+}
+
+vec4 vertex_main() {
+  atanh_70d5bd();
+  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 atanh_70d5bd() {
+  vec2 res = vec2(0.549306154f);
+}
+
+void fragment_main() {
+  atanh_70d5bd();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void atanh_70d5bd() {
+  vec2 res = vec2(0.549306154f);
+}
+
+void compute_main() {
+  atanh_70d5bd();
+}
+
+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/atanh/70d5bd.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.msl
new file mode 100644
index 0000000..57452f4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atanh_70d5bd() {
+  float2 res = float2(0.549306154f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  atanh_70d5bd();
+  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() {
+  atanh_70d5bd();
+  return;
+}
+
+kernel void compute_main() {
+  atanh_70d5bd();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.spvasm
new file mode 100644
index 0000000..e5fbe20
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/70d5bd.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 %atanh_70d5bd "atanh_70d5bd"
+               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_549306154 = OpConstant %float 0.549306154
+         %15 = OpConstantComposite %v2float %float_0_549306154 %float_0_549306154
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+         %18 = OpConstantNull %v2float
+         %19 = OpTypeFunction %v4float
+    %float_1 = OpConstant %float 1
+%atanh_70d5bd = 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 %atanh_70d5bd
+               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 %atanh_70d5bd
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %31 = OpLabel
+         %32 = OpFunctionCall %void %atanh_70d5bd
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.wgsl
new file mode 100644
index 0000000..b9d5063
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/70d5bd.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn atanh_70d5bd() {
+  var res = atanh(vec2(0.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_70d5bd();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_70d5bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_70d5bd();
+}
diff --git a/test/tint/builtins/gen/literal/atanh/7f2874.wgsl b/test/tint/builtins/gen/literal/atanh/7f2874.wgsl
new file mode 100644
index 0000000..bdf04750
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/7f2874.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 atanh(vec<3, fa>) -> vec<3, fa>
+fn atanh_7f2874() {
+  var res = atanh(vec3(0.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_7f2874();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_7f2874();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_7f2874();
+}
diff --git a/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..001e7db
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_7f2874() {
+  float3 res = (0.549306154f).xxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_7f2874();
+  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() {
+  atanh_7f2874();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_7f2874();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..001e7db
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_7f2874() {
+  float3 res = (0.549306154f).xxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_7f2874();
+  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() {
+  atanh_7f2874();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_7f2874();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.glsl
new file mode 100644
index 0000000..1de983e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atanh_7f2874() {
+  vec3 res = vec3(0.549306154f);
+}
+
+vec4 vertex_main() {
+  atanh_7f2874();
+  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 atanh_7f2874() {
+  vec3 res = vec3(0.549306154f);
+}
+
+void fragment_main() {
+  atanh_7f2874();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void atanh_7f2874() {
+  vec3 res = vec3(0.549306154f);
+}
+
+void compute_main() {
+  atanh_7f2874();
+}
+
+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/atanh/7f2874.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.msl
new file mode 100644
index 0000000..e93df5b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atanh_7f2874() {
+  float3 res = float3(0.549306154f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  atanh_7f2874();
+  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() {
+  atanh_7f2874();
+  return;
+}
+
+kernel void compute_main() {
+  atanh_7f2874();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.spvasm
new file mode 100644
index 0000000..0692aed
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/7f2874.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 %atanh_7f2874 "atanh_7f2874"
+               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_549306154 = OpConstant %float 0.549306154
+         %15 = OpConstantComposite %v3float %float_0_549306154 %float_0_549306154 %float_0_549306154
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+         %18 = OpConstantNull %v3float
+         %19 = OpTypeFunction %v4float
+    %float_1 = OpConstant %float 1
+%atanh_7f2874 = 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 %atanh_7f2874
+               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 %atanh_7f2874
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %31 = OpLabel
+         %32 = OpFunctionCall %void %atanh_7f2874
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.wgsl
new file mode 100644
index 0000000..2a96210
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/7f2874.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn atanh_7f2874() {
+  var res = atanh(vec3(0.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_7f2874();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_7f2874();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_7f2874();
+}
diff --git a/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl b/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl
new file mode 100644
index 0000000..0905a40
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/c5dc32.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 atanh(fa) -> fa
+fn atanh_c5dc32() {
+  var res = atanh(0.5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_c5dc32();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_c5dc32();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_c5dc32();
+}
diff --git a/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..8f168ec
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_c5dc32() {
+  float res = 0.549306154f;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_c5dc32();
+  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() {
+  atanh_c5dc32();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_c5dc32();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..8f168ec
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_c5dc32() {
+  float res = 0.549306154f;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_c5dc32();
+  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() {
+  atanh_c5dc32();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_c5dc32();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.glsl
new file mode 100644
index 0000000..0ce5962
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atanh_c5dc32() {
+  float res = 0.549306154f;
+}
+
+vec4 vertex_main() {
+  atanh_c5dc32();
+  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 atanh_c5dc32() {
+  float res = 0.549306154f;
+}
+
+void fragment_main() {
+  atanh_c5dc32();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void atanh_c5dc32() {
+  float res = 0.549306154f;
+}
+
+void compute_main() {
+  atanh_c5dc32();
+}
+
+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/atanh/c5dc32.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.msl
new file mode 100644
index 0000000..966c056
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atanh_c5dc32() {
+  float res = 0.549306154f;
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  atanh_c5dc32();
+  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() {
+  atanh_c5dc32();
+  return;
+}
+
+kernel void compute_main() {
+  atanh_c5dc32();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.spvasm
new file mode 100644
index 0000000..468c6f9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/c5dc32.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 %atanh_c5dc32 "atanh_c5dc32"
+               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_549306154 = OpConstant %float 0.549306154
+%_ptr_Function_float = OpTypePointer Function %float
+         %16 = OpTypeFunction %v4float
+    %float_1 = OpConstant %float 1
+%atanh_c5dc32 = OpFunction %void None %9
+         %12 = OpLabel
+        %res = OpVariable %_ptr_Function_float Function %8
+               OpStore %res %float_0_549306154
+               OpReturn
+               OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+         %18 = OpLabel
+         %19 = OpFunctionCall %void %atanh_c5dc32
+               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 %atanh_c5dc32
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %atanh_c5dc32
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.wgsl
new file mode 100644
index 0000000..f30ed21
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/c5dc32.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn atanh_c5dc32() {
+  var res = atanh(0.5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_c5dc32();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_c5dc32();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_c5dc32();
+}
diff --git a/test/tint/builtins/gen/literal/atanh/e431bb.wgsl b/test/tint/builtins/gen/literal/atanh/e431bb.wgsl
new file mode 100644
index 0000000..fc29d4e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/e431bb.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 atanh(vec<4, fa>) -> vec<4, fa>
+fn atanh_e431bb() {
+  var res = atanh(vec4(0.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_e431bb();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_e431bb();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_e431bb();
+}
diff --git a/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a1d65a3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_e431bb() {
+  float4 res = (0.549306154f).xxxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_e431bb();
+  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() {
+  atanh_e431bb();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_e431bb();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a1d65a3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_e431bb() {
+  float4 res = (0.549306154f).xxxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_e431bb();
+  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() {
+  atanh_e431bb();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_e431bb();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.glsl
new file mode 100644
index 0000000..240bd01
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atanh_e431bb() {
+  vec4 res = vec4(0.549306154f);
+}
+
+vec4 vertex_main() {
+  atanh_e431bb();
+  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 atanh_e431bb() {
+  vec4 res = vec4(0.549306154f);
+}
+
+void fragment_main() {
+  atanh_e431bb();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void atanh_e431bb() {
+  vec4 res = vec4(0.549306154f);
+}
+
+void compute_main() {
+  atanh_e431bb();
+}
+
+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/atanh/e431bb.wgsl.expected.msl b/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.msl
new file mode 100644
index 0000000..caa1898
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atanh_e431bb() {
+  float4 res = float4(0.549306154f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  atanh_e431bb();
+  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() {
+  atanh_e431bb();
+  return;
+}
+
+kernel void compute_main() {
+  atanh_e431bb();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.spvasm
new file mode 100644
index 0000000..f03ebda
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/e431bb.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 %atanh_e431bb "atanh_e431bb"
+               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_549306154 = OpConstant %float 0.549306154
+         %14 = OpConstantComposite %v4float %float_0_549306154 %float_0_549306154 %float_0_549306154 %float_0_549306154
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+         %17 = OpTypeFunction %v4float
+    %float_1 = OpConstant %float 1
+%atanh_e431bb = 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 %atanh_e431bb
+               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 %atanh_e431bb
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %29 = OpLabel
+         %30 = OpFunctionCall %void %atanh_e431bb
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.wgsl
new file mode 100644
index 0000000..671a74d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/atanh/e431bb.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn atanh_e431bb() {
+  var res = atanh(vec4(0.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_e431bb();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_e431bb();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_e431bb();
+}
diff --git a/test/tint/builtins/gen/var/atanh/70d5bd.wgsl b/test/tint/builtins/gen/var/atanh/70d5bd.wgsl
new file mode 100644
index 0000000..d625cc5
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/70d5bd.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 atanh(vec<2, fa>) -> vec<2, fa>
+fn atanh_70d5bd() {
+  const arg_0 = vec2(0.5);
+  var res = atanh(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_70d5bd();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_70d5bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_70d5bd();
+}
diff --git a/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..c309e30
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_70d5bd() {
+  float2 res = (0.549306154f).xx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_70d5bd();
+  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() {
+  atanh_70d5bd();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_70d5bd();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..c309e30
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_70d5bd() {
+  float2 res = (0.549306154f).xx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_70d5bd();
+  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() {
+  atanh_70d5bd();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_70d5bd();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.glsl
new file mode 100644
index 0000000..4810f62
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atanh_70d5bd() {
+  vec2 res = vec2(0.549306154f);
+}
+
+vec4 vertex_main() {
+  atanh_70d5bd();
+  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 atanh_70d5bd() {
+  vec2 res = vec2(0.549306154f);
+}
+
+void fragment_main() {
+  atanh_70d5bd();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void atanh_70d5bd() {
+  vec2 res = vec2(0.549306154f);
+}
+
+void compute_main() {
+  atanh_70d5bd();
+}
+
+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/atanh/70d5bd.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.msl
new file mode 100644
index 0000000..57452f4
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atanh_70d5bd() {
+  float2 res = float2(0.549306154f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  atanh_70d5bd();
+  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() {
+  atanh_70d5bd();
+  return;
+}
+
+kernel void compute_main() {
+  atanh_70d5bd();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.spvasm
new file mode 100644
index 0000000..e5fbe20
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/70d5bd.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 %atanh_70d5bd "atanh_70d5bd"
+               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_549306154 = OpConstant %float 0.549306154
+         %15 = OpConstantComposite %v2float %float_0_549306154 %float_0_549306154
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+         %18 = OpConstantNull %v2float
+         %19 = OpTypeFunction %v4float
+    %float_1 = OpConstant %float 1
+%atanh_70d5bd = 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 %atanh_70d5bd
+               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 %atanh_70d5bd
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %31 = OpLabel
+         %32 = OpFunctionCall %void %atanh_70d5bd
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.wgsl
new file mode 100644
index 0000000..7ec795c
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/70d5bd.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn atanh_70d5bd() {
+  const arg_0 = vec2(0.5);
+  var res = atanh(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_70d5bd();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_70d5bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_70d5bd();
+}
diff --git a/test/tint/builtins/gen/var/atanh/7f2874.wgsl b/test/tint/builtins/gen/var/atanh/7f2874.wgsl
new file mode 100644
index 0000000..2e310c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/7f2874.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 atanh(vec<3, fa>) -> vec<3, fa>
+fn atanh_7f2874() {
+  const arg_0 = vec3(0.5);
+  var res = atanh(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_7f2874();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_7f2874();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_7f2874();
+}
diff --git a/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..001e7db
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_7f2874() {
+  float3 res = (0.549306154f).xxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_7f2874();
+  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() {
+  atanh_7f2874();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_7f2874();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..001e7db
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_7f2874() {
+  float3 res = (0.549306154f).xxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_7f2874();
+  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() {
+  atanh_7f2874();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_7f2874();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.glsl
new file mode 100644
index 0000000..1de983e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atanh_7f2874() {
+  vec3 res = vec3(0.549306154f);
+}
+
+vec4 vertex_main() {
+  atanh_7f2874();
+  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 atanh_7f2874() {
+  vec3 res = vec3(0.549306154f);
+}
+
+void fragment_main() {
+  atanh_7f2874();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void atanh_7f2874() {
+  vec3 res = vec3(0.549306154f);
+}
+
+void compute_main() {
+  atanh_7f2874();
+}
+
+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/atanh/7f2874.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.msl
new file mode 100644
index 0000000..e93df5b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atanh_7f2874() {
+  float3 res = float3(0.549306154f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  atanh_7f2874();
+  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() {
+  atanh_7f2874();
+  return;
+}
+
+kernel void compute_main() {
+  atanh_7f2874();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.spvasm
new file mode 100644
index 0000000..0692aed
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/7f2874.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 %atanh_7f2874 "atanh_7f2874"
+               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_549306154 = OpConstant %float 0.549306154
+         %15 = OpConstantComposite %v3float %float_0_549306154 %float_0_549306154 %float_0_549306154
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+         %18 = OpConstantNull %v3float
+         %19 = OpTypeFunction %v4float
+    %float_1 = OpConstant %float 1
+%atanh_7f2874 = 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 %atanh_7f2874
+               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 %atanh_7f2874
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %31 = OpLabel
+         %32 = OpFunctionCall %void %atanh_7f2874
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.wgsl
new file mode 100644
index 0000000..8168b0a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/7f2874.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn atanh_7f2874() {
+  const arg_0 = vec3(0.5);
+  var res = atanh(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_7f2874();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_7f2874();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_7f2874();
+}
diff --git a/test/tint/builtins/gen/var/atanh/c5dc32.wgsl b/test/tint/builtins/gen/var/atanh/c5dc32.wgsl
new file mode 100644
index 0000000..357cb77
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/c5dc32.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 atanh(fa) -> fa
+fn atanh_c5dc32() {
+  const arg_0 = 0.5;
+  var res = atanh(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_c5dc32();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_c5dc32();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_c5dc32();
+}
diff --git a/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..8f168ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_c5dc32() {
+  float res = 0.549306154f;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_c5dc32();
+  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() {
+  atanh_c5dc32();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_c5dc32();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..8f168ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_c5dc32() {
+  float res = 0.549306154f;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_c5dc32();
+  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() {
+  atanh_c5dc32();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_c5dc32();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.glsl
new file mode 100644
index 0000000..0ce5962
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atanh_c5dc32() {
+  float res = 0.549306154f;
+}
+
+vec4 vertex_main() {
+  atanh_c5dc32();
+  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 atanh_c5dc32() {
+  float res = 0.549306154f;
+}
+
+void fragment_main() {
+  atanh_c5dc32();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void atanh_c5dc32() {
+  float res = 0.549306154f;
+}
+
+void compute_main() {
+  atanh_c5dc32();
+}
+
+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/atanh/c5dc32.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.msl
new file mode 100644
index 0000000..966c056
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atanh_c5dc32() {
+  float res = 0.549306154f;
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  atanh_c5dc32();
+  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() {
+  atanh_c5dc32();
+  return;
+}
+
+kernel void compute_main() {
+  atanh_c5dc32();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.spvasm
new file mode 100644
index 0000000..468c6f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/c5dc32.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 %atanh_c5dc32 "atanh_c5dc32"
+               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_549306154 = OpConstant %float 0.549306154
+%_ptr_Function_float = OpTypePointer Function %float
+         %16 = OpTypeFunction %v4float
+    %float_1 = OpConstant %float 1
+%atanh_c5dc32 = OpFunction %void None %9
+         %12 = OpLabel
+        %res = OpVariable %_ptr_Function_float Function %8
+               OpStore %res %float_0_549306154
+               OpReturn
+               OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+         %18 = OpLabel
+         %19 = OpFunctionCall %void %atanh_c5dc32
+               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 %atanh_c5dc32
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %atanh_c5dc32
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.wgsl
new file mode 100644
index 0000000..c259d2b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/c5dc32.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn atanh_c5dc32() {
+  const arg_0 = 0.5;
+  var res = atanh(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_c5dc32();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_c5dc32();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_c5dc32();
+}
diff --git a/test/tint/builtins/gen/var/atanh/e431bb.wgsl b/test/tint/builtins/gen/var/atanh/e431bb.wgsl
new file mode 100644
index 0000000..175c60e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/e431bb.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 atanh(vec<4, fa>) -> vec<4, fa>
+fn atanh_e431bb() {
+  const arg_0 = vec4(0.5);
+  var res = atanh(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_e431bb();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_e431bb();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_e431bb();
+}
diff --git a/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a1d65a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_e431bb() {
+  float4 res = (0.549306154f).xxxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_e431bb();
+  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() {
+  atanh_e431bb();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_e431bb();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a1d65a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void atanh_e431bb() {
+  float4 res = (0.549306154f).xxxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  atanh_e431bb();
+  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() {
+  atanh_e431bb();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  atanh_e431bb();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.glsl b/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.glsl
new file mode 100644
index 0000000..240bd01
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void atanh_e431bb() {
+  vec4 res = vec4(0.549306154f);
+}
+
+vec4 vertex_main() {
+  atanh_e431bb();
+  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 atanh_e431bb() {
+  vec4 res = vec4(0.549306154f);
+}
+
+void fragment_main() {
+  atanh_e431bb();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void atanh_e431bb() {
+  vec4 res = vec4(0.549306154f);
+}
+
+void compute_main() {
+  atanh_e431bb();
+}
+
+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/atanh/e431bb.wgsl.expected.msl b/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.msl
new file mode 100644
index 0000000..caa1898
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atanh_e431bb() {
+  float4 res = float4(0.549306154f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  atanh_e431bb();
+  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() {
+  atanh_e431bb();
+  return;
+}
+
+kernel void compute_main() {
+  atanh_e431bb();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.spvasm
new file mode 100644
index 0000000..f03ebda
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/e431bb.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 %atanh_e431bb "atanh_e431bb"
+               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_549306154 = OpConstant %float 0.549306154
+         %14 = OpConstantComposite %v4float %float_0_549306154 %float_0_549306154 %float_0_549306154 %float_0_549306154
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+         %17 = OpTypeFunction %v4float
+    %float_1 = OpConstant %float 1
+%atanh_e431bb = 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 %atanh_e431bb
+               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 %atanh_e431bb
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %29 = OpLabel
+         %30 = OpFunctionCall %void %atanh_e431bb
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.wgsl
new file mode 100644
index 0000000..19640ad
--- /dev/null
+++ b/test/tint/builtins/gen/var/atanh/e431bb.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn atanh_e431bb() {
+  const arg_0 = vec4(0.5);
+  var res = atanh(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  atanh_e431bb();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  atanh_e431bb();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  atanh_e431bb();
+}