Add const-eval for `sign`.

This CL adds const-eval for the `sign` builtin.

Bug: tint:1581
Change-Id: I5d9bfd3f3f742bcba69fbb0d7f47dc57ce18e134
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107460
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def
index 45e7186..9b48639 100644
--- a/src/tint/intrinsics.def
+++ b/src/tint/intrinsics.def
@@ -527,8 +527,8 @@
 @const("select_bool") fn select<T: scalar>(T, T, bool) -> T
 @const("select_bool") fn select<T: scalar, N: num>(vec<N, T>, vec<N, T>, bool) -> vec<N, T>
 @const("select_boolvec") fn select<N: num, T: scalar>(vec<N, T>, vec<N, T>, vec<N, bool>) -> vec<N, T>
-fn sign<T: f32_f16>(T) -> T
-fn sign<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
+@const fn sign<T: fa_f32_f16>(T) -> T
+@const fn sign<N: num, T: fa_f32_f16>(vec<N, T>) -> vec<N, T>
 fn sin<T: f32_f16>(T) -> T
 fn sin<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
 fn sinh<T: f32_f16>(T) -> T
diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc
index d9c3e52..cdca202 100644
--- a/src/tint/resolver/const_eval.cc
+++ b/src/tint/resolver/const_eval.cc
@@ -1659,6 +1659,28 @@
     return TransformElements(builder, ty, transform, args[0], args[1]);
 }
 
+ConstEval::Result ConstEval::sign(const sem::Type* ty,
+                                  utils::VectorRef<const sem::Constant*> args,
+                                  const Source&) {
+    auto transform = [&](const sem::Constant* c0) {
+        auto create = [&](auto e) -> ImplResult {
+            using NumberT = decltype(e);
+            NumberT result;
+            NumberT zero{0.0};
+            if (e.value < zero) {
+                result = NumberT{-1.0};
+            } else if (e.value > zero) {
+                result = NumberT{1.0};
+            } else {
+                result = zero;
+            }
+            return CreateElement(builder, c0->Type(), result);
+        };
+        return Dispatch_fa_f32_f16(create, c0);
+    };
+    return TransformElements(builder, ty, transform, args[0]);
+}
+
 ConstEval::Result ConstEval::step(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 cffdcca..009a92f 100644
--- a/src/tint/resolver/const_eval.h
+++ b/src/tint/resolver/const_eval.h
@@ -458,6 +458,15 @@
                           utils::VectorRef<const sem::Constant*> args,
                           const Source& source);
 
+    /// sign 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 sign(const sem::Type* ty,
+                utils::VectorRef<const sem::Constant*> args,
+                const Source& source);
+
     /// step 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 09e73da..d004b02 100644
--- a/src/tint/resolver/const_eval_builtin_test.cc
+++ b/src/tint/resolver/const_eval_builtin_test.cc
@@ -532,6 +532,32 @@
                                               SelectBoolCases()))));
 
 template <typename T>
+std::vector<Case> SignCases() {
+    return {
+        C({-T(1)}, -T(1)),
+        C({-T(0.5)}, -T(1)),
+        C({T(0)}, T(0)),
+        C({-T(0)}, T(0)),
+        C({T(0.5)}, T(1)),
+        C({T(1)}, T(1)),
+
+        C({T::Highest()}, T(1.0)),
+        C({T::Lowest()}, -T(1.0)),
+
+        // Vector tests
+        C({Vec(-T(0.5), T(0), T(0.5))}, Vec(-T(1.0), T(0.0), T(1.0))),
+        C({Vec(T::Highest(), T::Lowest())}, Vec(T(1.0), -T(1.0))),
+    };
+}
+INSTANTIATE_TEST_SUITE_P(  //
+    Sign,
+    ResolverConstEvalBuiltinTest,
+    testing::Combine(testing::Values(sem::BuiltinType::kSign),
+                     testing::ValuesIn(Concat(SignCases<AFloat>(),  //
+                                              SignCases<f32>(),
+                                              SignCases<f16>()))));
+
+template <typename T>
 std::vector<Case> StepCases() {
     return {
         C({T(0), T(0)}, T(1.0)),
diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl
index f2c9bdf..1adab49 100644
--- a/src/tint/resolver/intrinsic_table.inl
+++ b/src/tint/resolver/intrinsic_table.inl
@@ -12455,24 +12455,24 @@
     /* num parameters */ 1,
     /* num template types */ 1,
     /* num template numbers */ 0,
-    /* template types */ &kTemplateTypes[25],
+    /* template types */ &kTemplateTypes[24],
     /* template numbers */ &kTemplateNumbers[10],
     /* parameters */ &kParameters[904],
     /* return matcher indices */ &kMatcherIndices[1],
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
-    /* const eval */ nullptr,
+    /* const eval */ &ConstEval::sign,
   },
   {
     /* [345] */
     /* num parameters */ 1,
     /* num template types */ 1,
     /* num template numbers */ 1,
-    /* template types */ &kTemplateTypes[25],
+    /* template types */ &kTemplateTypes[24],
     /* template numbers */ &kTemplateNumbers[5],
     /* parameters */ &kParameters[905],
     /* return matcher indices */ &kMatcherIndices[30],
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
-    /* const eval */ nullptr,
+    /* const eval */ &ConstEval::sign,
   },
   {
     /* [346] */
@@ -14442,8 +14442,8 @@
   },
   {
     /* [68] */
-    /* fn sign<T : f32_f16>(T) -> T */
-    /* fn sign<N : num, T : f32_f16>(vec<N, T>) -> vec<N, T> */
+    /* fn sign<T : fa_f32_f16>(T) -> T */
+    /* fn sign<N : num, T : fa_f32_f16>(vec<N, T>) -> vec<N, T> */
     /* num overloads */ 2,
     /* overloads */ &kOverloads[344],
   },
diff --git a/test/tint/bug/tint/1534.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1534.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..5d4ad67
--- /dev/null
+++ b/test/tint/bug/tint/1534.wgsl.expected.dxc.hlsl
@@ -0,0 +1,11 @@
+cbuffer cbuffer_i : register(b0, space0) {
+  uint4 i[1];
+};
+RWByteAddressBuffer j : register(u1, space0);
+
+[numthreads(1, 1, 1)]
+void main() {
+  const uint l = dot(i[0].xyz, i[0].xyz);
+  j.Store(0u, asuint(i[0].x));
+  return;
+}
diff --git a/test/tint/bug/tint/1534.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1534.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..5d4ad67
--- /dev/null
+++ b/test/tint/bug/tint/1534.wgsl.expected.fxc.hlsl
@@ -0,0 +1,11 @@
+cbuffer cbuffer_i : register(b0, space0) {
+  uint4 i[1];
+};
+RWByteAddressBuffer j : register(u1, space0);
+
+[numthreads(1, 1, 1)]
+void main() {
+  const uint l = dot(i[0].xyz, i[0].xyz);
+  j.Store(0u, asuint(i[0].x));
+  return;
+}
diff --git a/test/tint/bug/tint/1534.wgsl.expected.glsl b/test/tint/bug/tint/1534.wgsl.expected.glsl
new file mode 100644
index 0000000..d7e5d45
--- /dev/null
+++ b/test/tint/bug/tint/1534.wgsl.expected.glsl
@@ -0,0 +1,25 @@
+#version 310 es
+
+uint tint_int_dot(uvec3 a, uvec3 b) {
+  return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
+}
+
+layout(binding = 0, std140) uniform g_ubo {
+  uvec3 a;
+  uint pad;
+} i;
+
+layout(binding = 1, std430) buffer h_ssbo {
+  uint a;
+} j;
+
+void tint_symbol() {
+  uint l = tint_int_dot(i.a, i.a);
+  j.a = i.a.x;
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  tint_symbol();
+  return;
+}
diff --git a/test/tint/bug/tint/1534.wgsl.expected.spvasm b/test/tint/bug/tint/1534.wgsl.expected.spvasm
new file mode 100644
index 0000000..0f4a0d5
--- /dev/null
+++ b/test/tint/bug/tint/1534.wgsl.expected.spvasm
@@ -0,0 +1,62 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %main "main"
+               OpExecutionMode %main LocalSize 1 1 1
+               OpName %g "g"
+               OpMemberName %g 0 "a"
+               OpName %i "i"
+               OpName %h "h"
+               OpMemberName %h 0 "a"
+               OpName %j "j"
+               OpName %main "main"
+               OpDecorate %g Block
+               OpMemberDecorate %g 0 Offset 0
+               OpDecorate %i NonWritable
+               OpDecorate %i DescriptorSet 0
+               OpDecorate %i Binding 0
+               OpDecorate %h Block
+               OpMemberDecorate %h 0 Offset 0
+               OpDecorate %j DescriptorSet 0
+               OpDecorate %j Binding 1
+       %uint = OpTypeInt 32 0
+     %v3uint = OpTypeVector %uint 3
+          %g = OpTypeStruct %v3uint
+%_ptr_Uniform_g = OpTypePointer Uniform %g
+          %i = OpVariable %_ptr_Uniform_g Uniform
+          %h = OpTypeStruct %uint
+%_ptr_StorageBuffer_h = OpTypePointer StorageBuffer %h
+          %j = OpVariable %_ptr_StorageBuffer_h StorageBuffer
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
+     %uint_0 = OpConstant %uint 0
+%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%_ptr_Uniform_uint = OpTypePointer Uniform %uint
+       %main = OpFunction %void None %9
+         %12 = OpLabel
+         %16 = OpAccessChain %_ptr_Uniform_v3uint %i %uint_0
+         %17 = OpLoad %v3uint %16
+         %18 = OpAccessChain %_ptr_Uniform_v3uint %i %uint_0
+         %19 = OpLoad %v3uint %18
+         %20 = OpCompositeExtract %uint %17 0
+         %21 = OpCompositeExtract %uint %19 0
+         %22 = OpIMul %uint %20 %21
+         %23 = OpCompositeExtract %uint %17 1
+         %24 = OpCompositeExtract %uint %19 1
+         %25 = OpIMul %uint %23 %24
+         %26 = OpIAdd %uint %22 %25
+         %27 = OpCompositeExtract %uint %17 2
+         %28 = OpCompositeExtract %uint %19 2
+         %29 = OpIMul %uint %27 %28
+         %13 = OpIAdd %uint %26 %29
+         %31 = OpAccessChain %_ptr_StorageBuffer_uint %j %uint_0
+         %33 = OpAccessChain %_ptr_Uniform_uint %i %uint_0 %uint_0
+         %34 = OpLoad %uint %33
+               OpStore %31 %34
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/bug/tint/1534.wgsl.expected.wgsl b/test/tint/bug/tint/1534.wgsl.expected.wgsl
new file mode 100644
index 0000000..36efab9
--- /dev/null
+++ b/test/tint/bug/tint/1534.wgsl.expected.wgsl
@@ -0,0 +1,17 @@
+struct g {
+  a : vec3<u32>,
+}
+
+struct h {
+  a : u32,
+}
+
+@group(0) @binding(0) var<uniform> i : g;
+
+@group(0) @binding(1) var<storage, read_write> j : h;
+
+@compute @workgroup_size(1)
+fn main() {
+  let l = dot(i.a, i.a);
+  j.a = i.a.x;
+}
diff --git a/test/tint/builtins/gen/literal/sign/0799fd.wgsl b/test/tint/builtins/gen/literal/sign/0799fd.wgsl
new file mode 100644
index 0000000..2aac595
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/0799fd.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 sign(vec<2, fa>) -> vec<2, fa>
+fn sign_0799fd() {
+  var res = sign(vec2(1));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_0799fd();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_0799fd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_0799fd();
+}
diff --git a/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e742a9b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void sign_0799fd() {
+  float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_0799fd();
+  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() {
+  sign_0799fd();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_0799fd();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e742a9b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void sign_0799fd() {
+  float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_0799fd();
+  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() {
+  sign_0799fd();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_0799fd();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.glsl
new file mode 100644
index 0000000..1bdb757
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void sign_0799fd() {
+  vec2 res = vec2(1.0f);
+}
+
+vec4 vertex_main() {
+  sign_0799fd();
+  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 sign_0799fd() {
+  vec2 res = vec2(1.0f);
+}
+
+void fragment_main() {
+  sign_0799fd();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void sign_0799fd() {
+  vec2 res = vec2(1.0f);
+}
+
+void compute_main() {
+  sign_0799fd();
+}
+
+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/sign/0799fd.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.msl
new file mode 100644
index 0000000..0342a1f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sign_0799fd() {
+  float2 res = float2(1.0f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  sign_0799fd();
+  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() {
+  sign_0799fd();
+  return;
+}
+
+kernel void compute_main() {
+  sign_0799fd();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.spvasm
new file mode 100644
index 0000000..9436eec
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %value "value"
+               OpName %vertex_point_size "vertex_point_size"
+               OpName %sign_0799fd "sign_0799fd"
+               OpName %res "res"
+               OpName %vertex_main_inner "vertex_main_inner"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %value BuiltIn Position
+               OpDecorate %vertex_point_size BuiltIn PointSize
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+          %5 = OpConstantNull %v4float
+      %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+          %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
+    %v2float = OpTypeVector %float 2
+    %float_1 = OpConstant %float 1
+         %15 = OpConstantComposite %v2float %float_1 %float_1
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+         %18 = OpConstantNull %v2float
+         %19 = OpTypeFunction %v4float
+%sign_0799fd = 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 %sign_0799fd
+               OpReturnValue %5
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+         %24 = OpLabel
+         %25 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %25
+               OpStore %vertex_point_size %float_1
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %sign_0799fd
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %sign_0799fd
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.wgsl
new file mode 100644
index 0000000..945a42b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/0799fd.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn sign_0799fd() {
+  var res = sign(vec2(1));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_0799fd();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_0799fd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_0799fd();
+}
diff --git a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.dxc.hlsl
index 0ab4fc7..c207e8a 100644
--- a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void sign_159665() {
-  float3 res = sign((1.0f).xxx);
+  float3 res = (1.0f).xxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.fxc.hlsl
index 0ab4fc7..c207e8a 100644
--- a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
 void sign_159665() {
-  float3 res = sign((1.0f).xxx);
+  float3 res = (1.0f).xxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.glsl
index 821e964..0bde0c3 100644
--- a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.glsl
@@ -1,7 +1,7 @@
 #version 310 es
 
 void sign_159665() {
-  vec3 res = sign(vec3(1.0f));
+  vec3 res = vec3(1.0f);
 }
 
 vec4 vertex_main() {
@@ -21,7 +21,7 @@
 precision mediump float;
 
 void sign_159665() {
-  vec3 res = sign(vec3(1.0f));
+  vec3 res = vec3(1.0f);
 }
 
 void fragment_main() {
@@ -35,7 +35,7 @@
 #version 310 es
 
 void sign_159665() {
-  vec3 res = sign(vec3(1.0f));
+  vec3 res = vec3(1.0f);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.msl
index d8f87fe..7426daa 100644
--- a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void sign_159665() {
-  float3 res = sign(float3(1.0f));
+  float3 res = float3(1.0f);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.spvasm
index 360dc6f..955be00 100644
--- a/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/sign/159665.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
 ; 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"
@@ -33,36 +32,35 @@
           %9 = OpTypeFunction %void
     %v3float = OpTypeVector %float 3
     %float_1 = OpConstant %float 1
-         %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+         %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
 %_ptr_Function_v3float = OpTypePointer Function %v3float
-         %20 = OpConstantNull %v3float
-         %21 = OpTypeFunction %v4float
+         %18 = OpConstantNull %v3float
+         %19 = OpTypeFunction %v4float
 %sign_159665 = OpFunction %void None %9
          %12 = OpLabel
-        %res = OpVariable %_ptr_Function_v3float Function %20
-         %13 = OpExtInst %v3float %15 FSign %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 %sign_159665
+%vertex_main_inner = OpFunction %v4float None %19
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %sign_159665
                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 %sign_159665
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %sign_159665
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %sign_159665
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %sign_159665
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.dxc.hlsl
index b8e2784..9152c39 100644
--- a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void sign_160933() {
-  vector<float16_t, 4> res = sign((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/sign/160933.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.glsl
index 23eade5..0c3ed69 100644
--- a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void sign_160933() {
-  f16vec4 res = sign(f16vec4(0.0hf));
+  f16vec4 res = f16vec4(0.0hf);
 }
 
 vec4 vertex_main() {
@@ -23,7 +23,7 @@
 precision mediump float;
 
 void sign_160933() {
-  f16vec4 res = sign(f16vec4(0.0hf));
+  f16vec4 res = f16vec4(0.0hf);
 }
 
 void fragment_main() {
@@ -38,7 +38,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void sign_160933() {
-  f16vec4 res = sign(f16vec4(0.0hf));
+  f16vec4 res = f16vec4(0.0hf);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.msl
index faf94ed..2f05c90 100644
--- a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void sign_160933() {
-  half4 res = sign(half4(0.0h));
+  half4 res = half4(0.0h);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.spvasm
index 9a1664c..40f0e92 100644
--- a/test/tint/builtins/gen/literal/sign/160933.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/sign/160933.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
 %sign_160933 = OpFunction %void None %9
          %12 = OpLabel
-        %res = OpVariable %_ptr_Function_v4half Function %17
-         %13 = OpExtInst %v4half %16 FSign %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 %sign_160933
+%vertex_main_inner = OpFunction %v4float None %18
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %sign_160933
                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 %sign_160933
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %sign_160933
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %sign_160933
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %sign_160933
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.dxc.hlsl
index 0331539..e8f8c0f 100644
--- a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void sign_5d283a() {
-  vector<float16_t, 3> res = sign((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/sign/5d283a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.glsl
index 4cda792..8530a60 100644
--- a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void sign_5d283a() {
-  f16vec3 res = sign(f16vec3(0.0hf));
+  f16vec3 res = f16vec3(0.0hf);
 }
 
 vec4 vertex_main() {
@@ -23,7 +23,7 @@
 precision mediump float;
 
 void sign_5d283a() {
-  f16vec3 res = sign(f16vec3(0.0hf));
+  f16vec3 res = f16vec3(0.0hf);
 }
 
 void fragment_main() {
@@ -38,7 +38,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void sign_5d283a() {
-  f16vec3 res = sign(f16vec3(0.0hf));
+  f16vec3 res = f16vec3(0.0hf);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.msl
index 3ffb6b8..b104c0e 100644
--- a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void sign_5d283a() {
-  half3 res = sign(half3(0.0h));
+  half3 res = half3(0.0h);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.spvasm
index 487c968..f36ab38 100644
--- a/test/tint/builtins/gen/literal/sign/5d283a.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/sign/5d283a.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
 %sign_5d283a = OpFunction %void None %9
          %12 = OpLabel
-        %res = OpVariable %_ptr_Function_v3half Function %17
-         %13 = OpExtInst %v3half %16 FSign %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 %sign_5d283a
+%vertex_main_inner = OpFunction %v4float None %18
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %sign_5d283a
                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 %sign_5d283a
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %sign_5d283a
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %sign_5d283a
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %sign_5d283a
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.dxc.hlsl
index fa81821..59e1630 100644
--- a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void sign_7c85ea() {
-  float16_t res = sign(float16_t(0.0h));
+  float16_t res = float16_t(0.0h);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.glsl
index c49bc28..200e748 100644
--- a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void sign_7c85ea() {
-  float16_t res = sign(0.0hf);
+  float16_t res = 0.0hf;
 }
 
 vec4 vertex_main() {
@@ -23,7 +23,7 @@
 precision mediump float;
 
 void sign_7c85ea() {
-  float16_t res = sign(0.0hf);
+  float16_t res = 0.0hf;
 }
 
 void fragment_main() {
@@ -38,7 +38,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void sign_7c85ea() {
-  float16_t res = sign(0.0hf);
+  float16_t res = 0.0hf;
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.msl
index 9f39434..4c1254e 100644
--- a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void sign_7c85ea() {
-  half res = sign(0.0h);
+  half res = 0.0h;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.spvasm
index f3a19c0..49de559 100644
--- a/test/tint/builtins/gen/literal/sign/7c85ea.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/sign/7c85ea.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
 %sign_7c85ea = OpFunction %void None %9
          %12 = OpLabel
-        %res = OpVariable %_ptr_Function_half Function %16
-         %13 = OpExtInst %half %15 FSign %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 %sign_7c85ea
+%vertex_main_inner = OpFunction %v4float None %17
+         %19 = OpLabel
+         %20 = OpFunctionCall %void %sign_7c85ea
                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 %sign_7c85ea
+         %26 = OpLabel
+         %27 = OpFunctionCall %void %sign_7c85ea
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %31 = OpLabel
-         %32 = OpFunctionCall %void %sign_7c85ea
+         %29 = OpLabel
+         %30 = OpFunctionCall %void %sign_7c85ea
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/sign/ab6301.wgsl b/test/tint/builtins/gen/literal/sign/ab6301.wgsl
new file mode 100644
index 0000000..e75ab68
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/ab6301.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 sign(vec<3, fa>) -> vec<3, fa>
+fn sign_ab6301() {
+  var res = sign(vec3(1));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_ab6301();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_ab6301();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_ab6301();
+}
diff --git a/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..13250af
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void sign_ab6301() {
+  float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_ab6301();
+  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() {
+  sign_ab6301();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_ab6301();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..13250af
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void sign_ab6301() {
+  float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_ab6301();
+  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() {
+  sign_ab6301();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_ab6301();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.glsl
new file mode 100644
index 0000000..77165ed
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void sign_ab6301() {
+  vec3 res = vec3(1.0f);
+}
+
+vec4 vertex_main() {
+  sign_ab6301();
+  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 sign_ab6301() {
+  vec3 res = vec3(1.0f);
+}
+
+void fragment_main() {
+  sign_ab6301();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void sign_ab6301() {
+  vec3 res = vec3(1.0f);
+}
+
+void compute_main() {
+  sign_ab6301();
+}
+
+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/sign/ab6301.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.msl
new file mode 100644
index 0000000..7c71f81
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sign_ab6301() {
+  float3 res = float3(1.0f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  sign_ab6301();
+  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() {
+  sign_ab6301();
+  return;
+}
+
+kernel void compute_main() {
+  sign_ab6301();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.spvasm
new file mode 100644
index 0000000..ec002d3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %value "value"
+               OpName %vertex_point_size "vertex_point_size"
+               OpName %sign_ab6301 "sign_ab6301"
+               OpName %res "res"
+               OpName %vertex_main_inner "vertex_main_inner"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %value BuiltIn Position
+               OpDecorate %vertex_point_size BuiltIn PointSize
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+          %5 = OpConstantNull %v4float
+      %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+          %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
+    %v3float = OpTypeVector %float 3
+    %float_1 = OpConstant %float 1
+         %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+         %18 = OpConstantNull %v3float
+         %19 = OpTypeFunction %v4float
+%sign_ab6301 = 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 %sign_ab6301
+               OpReturnValue %5
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+         %24 = OpLabel
+         %25 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %25
+               OpStore %vertex_point_size %float_1
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %sign_ab6301
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %sign_ab6301
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.wgsl
new file mode 100644
index 0000000..0109196
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/ab6301.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn sign_ab6301() {
+  var res = sign(vec3(1));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_ab6301();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_ab6301();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_ab6301();
+}
diff --git a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.dxc.hlsl
index dfad227..dc47787 100644
--- a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void sign_b8f634() {
-  float4 res = sign((1.0f).xxxx);
+  float4 res = (1.0f).xxxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.fxc.hlsl
index dfad227..dc47787 100644
--- a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
 void sign_b8f634() {
-  float4 res = sign((1.0f).xxxx);
+  float4 res = (1.0f).xxxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.glsl
index 85db73f..e0fe7e7 100644
--- a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.glsl
@@ -1,7 +1,7 @@
 #version 310 es
 
 void sign_b8f634() {
-  vec4 res = sign(vec4(1.0f));
+  vec4 res = vec4(1.0f);
 }
 
 vec4 vertex_main() {
@@ -21,7 +21,7 @@
 precision mediump float;
 
 void sign_b8f634() {
-  vec4 res = sign(vec4(1.0f));
+  vec4 res = vec4(1.0f);
 }
 
 void fragment_main() {
@@ -35,7 +35,7 @@
 #version 310 es
 
 void sign_b8f634() {
-  vec4 res = sign(vec4(1.0f));
+  vec4 res = vec4(1.0f);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.msl
index 44f67fb..510713a 100644
--- a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void sign_b8f634() {
-  float4 res = sign(float4(1.0f));
+  float4 res = float4(1.0f);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.spvasm
index 3f785b5..c8459ad 100644
--- a/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/sign/b8f634.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 32
+; 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"
@@ -32,35 +31,34 @@
        %void = OpTypeVoid
           %9 = OpTypeFunction %void
     %float_1 = OpConstant %float 1
-         %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+         %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
 %_ptr_Function_v4float = OpTypePointer Function %v4float
-         %19 = OpTypeFunction %v4float
+         %17 = OpTypeFunction %v4float
 %sign_b8f634 = OpFunction %void None %9
          %12 = OpLabel
         %res = OpVariable %_ptr_Function_v4float Function %5
-         %13 = OpExtInst %v4float %14 FSign %16
-               OpStore %res %13
+               OpStore %res %14
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %19
-         %21 = OpLabel
-         %22 = OpFunctionCall %void %sign_b8f634
+%vertex_main_inner = OpFunction %v4float None %17
+         %19 = OpLabel
+         %20 = OpFunctionCall %void %sign_b8f634
                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 %sign_b8f634
+         %25 = OpLabel
+         %26 = OpFunctionCall %void %sign_b8f634
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %30 = OpLabel
-         %31 = OpFunctionCall %void %sign_b8f634
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %sign_b8f634
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/sign/c8289c.wgsl b/test/tint/builtins/gen/literal/sign/c8289c.wgsl
new file mode 100644
index 0000000..7b6a065
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/c8289c.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 sign(fa) -> fa
+fn sign_c8289c() {
+  var res = sign(1);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_c8289c();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_c8289c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_c8289c();
+}
diff --git a/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..f8d35c6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void sign_c8289c() {
+  float res = 1.0f;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_c8289c();
+  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() {
+  sign_c8289c();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_c8289c();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..f8d35c6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void sign_c8289c() {
+  float res = 1.0f;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_c8289c();
+  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() {
+  sign_c8289c();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_c8289c();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.glsl
new file mode 100644
index 0000000..f30b888
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void sign_c8289c() {
+  float res = 1.0f;
+}
+
+vec4 vertex_main() {
+  sign_c8289c();
+  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 sign_c8289c() {
+  float res = 1.0f;
+}
+
+void fragment_main() {
+  sign_c8289c();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void sign_c8289c() {
+  float res = 1.0f;
+}
+
+void compute_main() {
+  sign_c8289c();
+}
+
+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/sign/c8289c.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.msl
new file mode 100644
index 0000000..3e00de1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sign_c8289c() {
+  float res = 1.0f;
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  sign_c8289c();
+  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() {
+  sign_c8289c();
+  return;
+}
+
+kernel void compute_main() {
+  sign_c8289c();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.spvasm
new file mode 100644
index 0000000..0222630
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.spvasm
@@ -0,0 +1,63 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %value "value"
+               OpName %vertex_point_size "vertex_point_size"
+               OpName %sign_c8289c "sign_c8289c"
+               OpName %res "res"
+               OpName %vertex_main_inner "vertex_main_inner"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %value BuiltIn Position
+               OpDecorate %vertex_point_size BuiltIn PointSize
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+          %5 = OpConstantNull %v4float
+      %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+          %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
+    %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+         %16 = OpTypeFunction %v4float
+%sign_c8289c = OpFunction %void None %9
+         %12 = OpLabel
+        %res = OpVariable %_ptr_Function_float Function %8
+               OpStore %res %float_1
+               OpReturn
+               OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+         %18 = OpLabel
+         %19 = OpFunctionCall %void %sign_c8289c
+               OpReturnValue %5
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+         %21 = OpLabel
+         %22 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %22
+               OpStore %vertex_point_size %float_1
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %sign_c8289c
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %sign_c8289c
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.wgsl
new file mode 100644
index 0000000..3c04064
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/c8289c.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn sign_c8289c() {
+  var res = sign(1);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_c8289c();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_c8289c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_c8289c();
+}
diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.dxc.hlsl
index e0c820c..ac168b5 100644
--- a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void sign_ccdb3c() {
-  vector<float16_t, 2> res = sign((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/sign/ccdb3c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.glsl
index fae5053..706af13 100644
--- a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void sign_ccdb3c() {
-  f16vec2 res = sign(f16vec2(0.0hf));
+  f16vec2 res = f16vec2(0.0hf);
 }
 
 vec4 vertex_main() {
@@ -23,7 +23,7 @@
 precision mediump float;
 
 void sign_ccdb3c() {
-  f16vec2 res = sign(f16vec2(0.0hf));
+  f16vec2 res = f16vec2(0.0hf);
 }
 
 void fragment_main() {
@@ -38,7 +38,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void sign_ccdb3c() {
-  f16vec2 res = sign(f16vec2(0.0hf));
+  f16vec2 res = f16vec2(0.0hf);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.msl
index 8df474b..57c9090 100644
--- a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void sign_ccdb3c() {
-  half2 res = sign(half2(0.0h));
+  half2 res = half2(0.0h);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.spvasm
index 8366c62..a9f3c86 100644
--- a/test/tint/builtins/gen/literal/sign/ccdb3c.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/sign/ccdb3c.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
 %sign_ccdb3c = OpFunction %void None %9
          %12 = OpLabel
-        %res = OpVariable %_ptr_Function_v2half Function %17
-         %13 = OpExtInst %v2half %16 FSign %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 %sign_ccdb3c
+%vertex_main_inner = OpFunction %v4float None %18
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %sign_ccdb3c
                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 %sign_ccdb3c
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %sign_ccdb3c
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %sign_ccdb3c
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %sign_ccdb3c
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.dxc.hlsl
index b7571a8..3b9404c 100644
--- a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void sign_d065d8() {
-  float2 res = sign((1.0f).xx);
+  float2 res = (1.0f).xx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.fxc.hlsl
index b7571a8..3b9404c 100644
--- a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
 void sign_d065d8() {
-  float2 res = sign((1.0f).xx);
+  float2 res = (1.0f).xx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.glsl
index 80e261f..fdcae5e 100644
--- a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.glsl
@@ -1,7 +1,7 @@
 #version 310 es
 
 void sign_d065d8() {
-  vec2 res = sign(vec2(1.0f));
+  vec2 res = vec2(1.0f);
 }
 
 vec4 vertex_main() {
@@ -21,7 +21,7 @@
 precision mediump float;
 
 void sign_d065d8() {
-  vec2 res = sign(vec2(1.0f));
+  vec2 res = vec2(1.0f);
 }
 
 void fragment_main() {
@@ -35,7 +35,7 @@
 #version 310 es
 
 void sign_d065d8() {
-  vec2 res = sign(vec2(1.0f));
+  vec2 res = vec2(1.0f);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.msl
index b810a3d..3acf27f 100644
--- a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void sign_d065d8() {
-  float2 res = sign(float2(1.0f));
+  float2 res = float2(1.0f);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.spvasm
index ff49cd3..8cc157f 100644
--- a/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/sign/d065d8.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
 ; 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"
@@ -33,36 +32,35 @@
           %9 = OpTypeFunction %void
     %v2float = OpTypeVector %float 2
     %float_1 = OpConstant %float 1
-         %17 = OpConstantComposite %v2float %float_1 %float_1
+         %15 = OpConstantComposite %v2float %float_1 %float_1
 %_ptr_Function_v2float = OpTypePointer Function %v2float
-         %20 = OpConstantNull %v2float
-         %21 = OpTypeFunction %v4float
+         %18 = OpConstantNull %v2float
+         %19 = OpTypeFunction %v4float
 %sign_d065d8 = OpFunction %void None %9
          %12 = OpLabel
-        %res = OpVariable %_ptr_Function_v2float Function %20
-         %13 = OpExtInst %v2float %15 FSign %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 %sign_d065d8
+%vertex_main_inner = OpFunction %v4float None %19
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %sign_d065d8
                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 %sign_d065d8
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %sign_d065d8
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %sign_d065d8
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %sign_d065d8
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.dxc.hlsl
index a2aaa71..7bb7ad4 100644
--- a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void sign_dd790e() {
-  float res = sign(1.0f);
+  float res = 1.0f;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.fxc.hlsl
index a2aaa71..7bb7ad4 100644
--- a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
 void sign_dd790e() {
-  float res = sign(1.0f);
+  float res = 1.0f;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.glsl
index 129fd0e..c922c46 100644
--- a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.glsl
@@ -1,7 +1,7 @@
 #version 310 es
 
 void sign_dd790e() {
-  float res = sign(1.0f);
+  float res = 1.0f;
 }
 
 vec4 vertex_main() {
@@ -21,7 +21,7 @@
 precision mediump float;
 
 void sign_dd790e() {
-  float res = sign(1.0f);
+  float res = 1.0f;
 }
 
 void fragment_main() {
@@ -35,7 +35,7 @@
 #version 310 es
 
 void sign_dd790e() {
-  float res = sign(1.0f);
+  float res = 1.0f;
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.msl
index a5f99f6..8fab506 100644
--- a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void sign_dd790e() {
-  float res = sign(1.0f);
+  float res = 1.0f;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.spvasm
index 9069f50..600afaa 100644
--- a/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/sign/dd790e.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 29
 ; 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"
@@ -33,33 +32,32 @@
           %9 = OpTypeFunction %void
     %float_1 = OpConstant %float 1
 %_ptr_Function_float = OpTypePointer Function %float
-         %18 = OpTypeFunction %v4float
+         %16 = OpTypeFunction %v4float
 %sign_dd790e = OpFunction %void None %9
          %12 = OpLabel
         %res = OpVariable %_ptr_Function_float Function %8
-         %13 = OpExtInst %float %14 FSign %float_1
-               OpStore %res %13
+               OpStore %res %float_1
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %18
-         %20 = OpLabel
-         %21 = OpFunctionCall %void %sign_dd790e
+%vertex_main_inner = OpFunction %v4float None %16
+         %18 = OpLabel
+         %19 = OpFunctionCall %void %sign_dd790e
                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 %sign_dd790e
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %sign_dd790e
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %29 = OpLabel
-         %30 = OpFunctionCall %void %sign_dd790e
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %sign_dd790e
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/sign/f5da6a.wgsl b/test/tint/builtins/gen/literal/sign/f5da6a.wgsl
new file mode 100644
index 0000000..17b6d68
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/f5da6a.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 sign(vec<4, fa>) -> vec<4, fa>
+fn sign_f5da6a() {
+  var res = sign(vec4(1));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_f5da6a();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_f5da6a();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_f5da6a();
+}
diff --git a/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..5028f7a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void sign_f5da6a() {
+  float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_f5da6a();
+  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() {
+  sign_f5da6a();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_f5da6a();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..5028f7a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void sign_f5da6a() {
+  float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_f5da6a();
+  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() {
+  sign_f5da6a();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_f5da6a();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.glsl
new file mode 100644
index 0000000..9baba40
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void sign_f5da6a() {
+  vec4 res = vec4(1.0f);
+}
+
+vec4 vertex_main() {
+  sign_f5da6a();
+  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 sign_f5da6a() {
+  vec4 res = vec4(1.0f);
+}
+
+void fragment_main() {
+  sign_f5da6a();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void sign_f5da6a() {
+  vec4 res = vec4(1.0f);
+}
+
+void compute_main() {
+  sign_f5da6a();
+}
+
+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/sign/f5da6a.wgsl.expected.msl b/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.msl
new file mode 100644
index 0000000..b81d798
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sign_f5da6a() {
+  float4 res = float4(1.0f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  sign_f5da6a();
+  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() {
+  sign_f5da6a();
+  return;
+}
+
+kernel void compute_main() {
+  sign_f5da6a();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.spvasm
new file mode 100644
index 0000000..6af5227
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/f5da6a.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 %sign_f5da6a "sign_f5da6a"
+               OpName %res "res"
+               OpName %vertex_main_inner "vertex_main_inner"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %value BuiltIn Position
+               OpDecorate %vertex_point_size BuiltIn PointSize
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+          %5 = OpConstantNull %v4float
+      %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+          %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
+    %float_1 = OpConstant %float 1
+         %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+         %17 = OpTypeFunction %v4float
+%sign_f5da6a = 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 %sign_f5da6a
+               OpReturnValue %5
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+         %22 = OpLabel
+         %23 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %23
+               OpStore %vertex_point_size %float_1
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+         %25 = OpLabel
+         %26 = OpFunctionCall %void %sign_f5da6a
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %sign_f5da6a
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.wgsl
new file mode 100644
index 0000000..25336af
--- /dev/null
+++ b/test/tint/builtins/gen/literal/sign/f5da6a.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn sign_f5da6a() {
+  var res = sign(vec4(1));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_f5da6a();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_f5da6a();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_f5da6a();
+}
diff --git a/test/tint/builtins/gen/var/sign/0799fd.wgsl b/test/tint/builtins/gen/var/sign/0799fd.wgsl
new file mode 100644
index 0000000..1ee65e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/0799fd.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 sign(vec<2, fa>) -> vec<2, fa>
+fn sign_0799fd() {
+  const arg_0 = vec2(1);
+  var res = sign(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_0799fd();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_0799fd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_0799fd();
+}
diff --git a/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e742a9b
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void sign_0799fd() {
+  float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_0799fd();
+  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() {
+  sign_0799fd();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_0799fd();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e742a9b
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void sign_0799fd() {
+  float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_0799fd();
+  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() {
+  sign_0799fd();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_0799fd();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.glsl
new file mode 100644
index 0000000..1bdb757
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void sign_0799fd() {
+  vec2 res = vec2(1.0f);
+}
+
+vec4 vertex_main() {
+  sign_0799fd();
+  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 sign_0799fd() {
+  vec2 res = vec2(1.0f);
+}
+
+void fragment_main() {
+  sign_0799fd();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void sign_0799fd() {
+  vec2 res = vec2(1.0f);
+}
+
+void compute_main() {
+  sign_0799fd();
+}
+
+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/sign/0799fd.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.msl
new file mode 100644
index 0000000..0342a1f
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sign_0799fd() {
+  float2 res = float2(1.0f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  sign_0799fd();
+  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() {
+  sign_0799fd();
+  return;
+}
+
+kernel void compute_main() {
+  sign_0799fd();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.spvasm
new file mode 100644
index 0000000..9436eec
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %value "value"
+               OpName %vertex_point_size "vertex_point_size"
+               OpName %sign_0799fd "sign_0799fd"
+               OpName %res "res"
+               OpName %vertex_main_inner "vertex_main_inner"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %value BuiltIn Position
+               OpDecorate %vertex_point_size BuiltIn PointSize
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+          %5 = OpConstantNull %v4float
+      %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+          %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
+    %v2float = OpTypeVector %float 2
+    %float_1 = OpConstant %float 1
+         %15 = OpConstantComposite %v2float %float_1 %float_1
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+         %18 = OpConstantNull %v2float
+         %19 = OpTypeFunction %v4float
+%sign_0799fd = 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 %sign_0799fd
+               OpReturnValue %5
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+         %24 = OpLabel
+         %25 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %25
+               OpStore %vertex_point_size %float_1
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %sign_0799fd
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %sign_0799fd
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.wgsl
new file mode 100644
index 0000000..6193c87
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/0799fd.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sign_0799fd() {
+  const arg_0 = vec2(1);
+  var res = sign(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_0799fd();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_0799fd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_0799fd();
+}
diff --git a/test/tint/builtins/gen/var/sign/ab6301.wgsl b/test/tint/builtins/gen/var/sign/ab6301.wgsl
new file mode 100644
index 0000000..cb4bdf9
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/ab6301.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 sign(vec<3, fa>) -> vec<3, fa>
+fn sign_ab6301() {
+  const arg_0 = vec3(1);
+  var res = sign(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_ab6301();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_ab6301();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_ab6301();
+}
diff --git a/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..13250af
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void sign_ab6301() {
+  float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_ab6301();
+  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() {
+  sign_ab6301();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_ab6301();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..13250af
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void sign_ab6301() {
+  float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_ab6301();
+  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() {
+  sign_ab6301();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_ab6301();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.glsl
new file mode 100644
index 0000000..77165ed
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void sign_ab6301() {
+  vec3 res = vec3(1.0f);
+}
+
+vec4 vertex_main() {
+  sign_ab6301();
+  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 sign_ab6301() {
+  vec3 res = vec3(1.0f);
+}
+
+void fragment_main() {
+  sign_ab6301();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void sign_ab6301() {
+  vec3 res = vec3(1.0f);
+}
+
+void compute_main() {
+  sign_ab6301();
+}
+
+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/sign/ab6301.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.msl
new file mode 100644
index 0000000..7c71f81
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sign_ab6301() {
+  float3 res = float3(1.0f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  sign_ab6301();
+  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() {
+  sign_ab6301();
+  return;
+}
+
+kernel void compute_main() {
+  sign_ab6301();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.spvasm
new file mode 100644
index 0000000..ec002d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %value "value"
+               OpName %vertex_point_size "vertex_point_size"
+               OpName %sign_ab6301 "sign_ab6301"
+               OpName %res "res"
+               OpName %vertex_main_inner "vertex_main_inner"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %value BuiltIn Position
+               OpDecorate %vertex_point_size BuiltIn PointSize
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+          %5 = OpConstantNull %v4float
+      %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+          %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
+    %v3float = OpTypeVector %float 3
+    %float_1 = OpConstant %float 1
+         %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+         %18 = OpConstantNull %v3float
+         %19 = OpTypeFunction %v4float
+%sign_ab6301 = 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 %sign_ab6301
+               OpReturnValue %5
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+         %24 = OpLabel
+         %25 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %25
+               OpStore %vertex_point_size %float_1
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %sign_ab6301
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %sign_ab6301
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.wgsl
new file mode 100644
index 0000000..acf4f43
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/ab6301.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sign_ab6301() {
+  const arg_0 = vec3(1);
+  var res = sign(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_ab6301();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_ab6301();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_ab6301();
+}
diff --git a/test/tint/builtins/gen/var/sign/c8289c.wgsl b/test/tint/builtins/gen/var/sign/c8289c.wgsl
new file mode 100644
index 0000000..c6e764b
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/c8289c.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 sign(fa) -> fa
+fn sign_c8289c() {
+  const arg_0 = 1;
+  var res = sign(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_c8289c();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_c8289c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_c8289c();
+}
diff --git a/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..f8d35c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void sign_c8289c() {
+  float res = 1.0f;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_c8289c();
+  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() {
+  sign_c8289c();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_c8289c();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..f8d35c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void sign_c8289c() {
+  float res = 1.0f;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_c8289c();
+  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() {
+  sign_c8289c();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_c8289c();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.glsl
new file mode 100644
index 0000000..f30b888
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void sign_c8289c() {
+  float res = 1.0f;
+}
+
+vec4 vertex_main() {
+  sign_c8289c();
+  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 sign_c8289c() {
+  float res = 1.0f;
+}
+
+void fragment_main() {
+  sign_c8289c();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void sign_c8289c() {
+  float res = 1.0f;
+}
+
+void compute_main() {
+  sign_c8289c();
+}
+
+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/sign/c8289c.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.msl
new file mode 100644
index 0000000..3e00de1
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sign_c8289c() {
+  float res = 1.0f;
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  sign_c8289c();
+  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() {
+  sign_c8289c();
+  return;
+}
+
+kernel void compute_main() {
+  sign_c8289c();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.spvasm
new file mode 100644
index 0000000..0222630
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.spvasm
@@ -0,0 +1,63 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+               OpEntryPoint Fragment %fragment_main "fragment_main"
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %fragment_main OriginUpperLeft
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %value "value"
+               OpName %vertex_point_size "vertex_point_size"
+               OpName %sign_c8289c "sign_c8289c"
+               OpName %res "res"
+               OpName %vertex_main_inner "vertex_main_inner"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %value BuiltIn Position
+               OpDecorate %vertex_point_size BuiltIn PointSize
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+          %5 = OpConstantNull %v4float
+      %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+          %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
+    %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+         %16 = OpTypeFunction %v4float
+%sign_c8289c = OpFunction %void None %9
+         %12 = OpLabel
+        %res = OpVariable %_ptr_Function_float Function %8
+               OpStore %res %float_1
+               OpReturn
+               OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+         %18 = OpLabel
+         %19 = OpFunctionCall %void %sign_c8289c
+               OpReturnValue %5
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+         %21 = OpLabel
+         %22 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %22
+               OpStore %vertex_point_size %float_1
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %sign_c8289c
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %sign_c8289c
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.wgsl
new file mode 100644
index 0000000..60ab1f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/c8289c.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sign_c8289c() {
+  const arg_0 = 1;
+  var res = sign(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_c8289c();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_c8289c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_c8289c();
+}
diff --git a/test/tint/builtins/gen/var/sign/f5da6a.wgsl b/test/tint/builtins/gen/var/sign/f5da6a.wgsl
new file mode 100644
index 0000000..e5287d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/f5da6a.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 sign(vec<4, fa>) -> vec<4, fa>
+fn sign_f5da6a() {
+  const arg_0 = vec4(1);
+  var res = sign(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_f5da6a();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_f5da6a();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_f5da6a();
+}
diff --git a/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..5028f7a
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void sign_f5da6a() {
+  float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_f5da6a();
+  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() {
+  sign_f5da6a();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_f5da6a();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..5028f7a
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void sign_f5da6a() {
+  float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  sign_f5da6a();
+  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() {
+  sign_f5da6a();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  sign_f5da6a();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.glsl
new file mode 100644
index 0000000..9baba40
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void sign_f5da6a() {
+  vec4 res = vec4(1.0f);
+}
+
+vec4 vertex_main() {
+  sign_f5da6a();
+  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 sign_f5da6a() {
+  vec4 res = vec4(1.0f);
+}
+
+void fragment_main() {
+  sign_f5da6a();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void sign_f5da6a() {
+  vec4 res = vec4(1.0f);
+}
+
+void compute_main() {
+  sign_f5da6a();
+}
+
+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/sign/f5da6a.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.msl
new file mode 100644
index 0000000..b81d798
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sign_f5da6a() {
+  float4 res = float4(1.0f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  sign_f5da6a();
+  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() {
+  sign_f5da6a();
+  return;
+}
+
+kernel void compute_main() {
+  sign_f5da6a();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.spvasm
new file mode 100644
index 0000000..6af5227
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/f5da6a.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 %sign_f5da6a "sign_f5da6a"
+               OpName %res "res"
+               OpName %vertex_main_inner "vertex_main_inner"
+               OpName %vertex_main "vertex_main"
+               OpName %fragment_main "fragment_main"
+               OpName %compute_main "compute_main"
+               OpDecorate %value BuiltIn Position
+               OpDecorate %vertex_point_size BuiltIn PointSize
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+          %5 = OpConstantNull %v4float
+      %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+          %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
+    %float_1 = OpConstant %float 1
+         %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+         %17 = OpTypeFunction %v4float
+%sign_f5da6a = 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 %sign_f5da6a
+               OpReturnValue %5
+               OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+         %22 = OpLabel
+         %23 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %23
+               OpStore %vertex_point_size %float_1
+               OpReturn
+               OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+         %25 = OpLabel
+         %26 = OpFunctionCall %void %sign_f5da6a
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %sign_f5da6a
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.wgsl
new file mode 100644
index 0000000..d01498f
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/f5da6a.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sign_f5da6a() {
+  const arg_0 = vec4(1);
+  var res = sign(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  sign_f5da6a();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  sign_f5da6a();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  sign_f5da6a();
+}