Add const-eval for `trunc`

This CL adds const-eval for `trunc`.

Bug: tint:1581
Change-Id: If58f79ea70fe490746e30ed118d847c61edd8023
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110173
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def
index 0511078..5a088db 100644
--- a/src/tint/intrinsics.def
+++ b/src/tint/intrinsics.def
@@ -547,8 +547,8 @@
 @const fn tanh<T: fa_f32_f16>(T) -> T
 @const fn tanh<N: num, T: fa_f32_f16>(vec<N, T>) -> vec<N, T>
 fn transpose<M: num, N: num, T: f32_f16>(mat<M, N, T>) -> mat<N, M, T>
-fn trunc<T: f32_f16>(T) -> T
-fn trunc<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
+@const fn trunc<T: fa_f32_f16>(@test_value(1.5) T) -> T
+@const fn trunc<N: num, T: fa_f32_f16>(@test_value(1.5) vec<N, T>) -> vec<N, T>
 @const fn unpack2x16float(u32) -> vec2<f32>
 @const fn unpack2x16snorm(u32) -> vec2<f32>
 @const fn unpack2x16unorm(u32) -> vec2<f32>
diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc
index b1d4cbf..251690f 100644
--- a/src/tint/resolver/const_eval.cc
+++ b/src/tint/resolver/const_eval.cc
@@ -2401,6 +2401,18 @@
     return TransformElements(builder, ty, transform, args[0]);
 }
 
+ConstEval::Result ConstEval::trunc(const sem::Type* ty,
+                                   utils::VectorRef<const sem::Constant*> args,
+                                   const Source&) {
+    auto transform = [&](const sem::Constant* c0) {
+        auto create = [&](auto i) {
+            return CreateElement(builder, c0->Type(), decltype(i)(std::trunc(i.value)));
+        };
+        return Dispatch_fa_f32_f16(create, c0);
+    };
+    return TransformElements(builder, ty, transform, args[0]);
+}
+
 ConstEval::Result ConstEval::unpack2x16float(const sem::Type* ty,
                                              utils::VectorRef<const sem::Constant*> args,
                                              const Source& source) {
diff --git a/src/tint/resolver/const_eval.h b/src/tint/resolver/const_eval.h
index 5c7062f..e64511b 100644
--- a/src/tint/resolver/const_eval.h
+++ b/src/tint/resolver/const_eval.h
@@ -737,6 +737,15 @@
                 utils::VectorRef<const sem::Constant*> args,
                 const Source& source);
 
+    /// trunc 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 trunc(const sem::Type* ty,
+                 utils::VectorRef<const sem::Constant*> args,
+                 const Source& source);
+
     /// unpack2x16float 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 ac67054..b23cc0c 100644
--- a/src/tint/resolver/const_eval_builtin_test.cc
+++ b/src/tint/resolver/const_eval_builtin_test.cc
@@ -1693,6 +1693,26 @@
                                               TanhCases<f32>(),
                                               TanhCases<f16>()))));
 
+template <typename T>
+std::vector<Case> TruncCases() {
+    std::vector<Case> cases = {C({T(0)}, T(0)),    //
+                               C({-T(0)}, -T(0)),  //
+                               C({T(1.5)}, T(1)),  //
+                               C({-T(1.5)}, -T(1)),
+
+                               // Vector tests
+                               C({Vec(T(0.0), T(1.5), -T(2.2))}, Vec(T(0), T(1), -T(2)))};
+
+    return cases;
+}
+INSTANTIATE_TEST_SUITE_P(  //
+    Trunc,
+    ResolverConstEvalBuiltinTest,
+    testing::Combine(testing::Values(sem::BuiltinType::kTrunc),
+                     testing::ValuesIn(Concat(TruncCases<AFloat>(),  //
+                                              TruncCases<f32>(),
+                                              TruncCases<f16>()))));
+
 std::vector<Case> Unpack4x8snormCases() {
     return {
         C({Val(u32(0x0000'0000))}, Vec(f32(0), f32(0), f32(0), f32(0))),
diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl
index 4c13e0b..66bbf72 100644
--- a/src/tint/resolver/intrinsic_table.inl
+++ b/src/tint/resolver/intrinsic_table.inl
@@ -12729,24 +12729,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[977],
     /* return matcher indices */ &kMatcherIndices[1],
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
-    /* const eval */ nullptr,
+    /* const eval */ &ConstEval::trunc,
   },
   {
     /* [367] */
     /* 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[976],
     /* return matcher indices */ &kMatcherIndices[30],
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
-    /* const eval */ nullptr,
+    /* const eval */ &ConstEval::trunc,
   },
   {
     /* [368] */
@@ -14551,8 +14551,8 @@
   },
   {
     /* [79] */
-    /* fn trunc<T : f32_f16>(T) -> T */
-    /* fn trunc<N : num, T : f32_f16>(vec<N, T>) -> vec<N, T> */
+    /* fn trunc<T : fa_f32_f16>(@test_value(1.5) T) -> T */
+    /* fn trunc<N : num, T : fa_f32_f16>(@test_value(1.5) vec<N, T>) -> vec<N, T> */
     /* num overloads */ 2,
     /* overloads */ &kOverloads[366],
   },
diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl
index 5a2495e..1f706a8 100644
--- a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl
@@ -25,7 +25,7 @@
 
 // fn trunc(vec<3, f16>) -> vec<3, f16>
 fn trunc_103ab8() {
-  var res: vec3<f16> = trunc(vec3<f16>(1.h));
+  var res: vec3<f16> = trunc(vec3<f16>(1.5h));
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.dxc.hlsl
index ffe1f6e..6d8f7b3 100644
--- a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_103ab8() {
-  vector<float16_t, 3> res = trunc((float16_t(1.0h)).xxx);
+  vector<float16_t, 3> res = (float16_t(1.0h)).xxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.glsl
index 946f9f3..fc8d55c 100644
--- a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_103ab8() {
-  f16vec3 res = trunc(f16vec3(1.0hf));
+  f16vec3 res = f16vec3(1.0hf);
 }
 
 vec4 vertex_main() {
@@ -23,7 +23,7 @@
 precision mediump float;
 
 void trunc_103ab8() {
-  f16vec3 res = trunc(f16vec3(1.0hf));
+  f16vec3 res = f16vec3(1.0hf);
 }
 
 void fragment_main() {
@@ -38,7 +38,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_103ab8() {
-  f16vec3 res = trunc(f16vec3(1.0hf));
+  f16vec3 res = f16vec3(1.0hf);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.msl
index 247d36c..0714cab 100644
--- a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_103ab8() {
-  half3 res = trunc(half3(1.0h));
+  half3 res = half3(1.0h);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.spvasm
index 537ed0be..883bfc3 100644
--- a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 34
 ; 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"
@@ -38,37 +37,36 @@
        %half = OpTypeFloat 16
      %v3half = OpTypeVector %half 3
 %half_0x1p_0 = OpConstant %half 0x1p+0
-         %18 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
+         %16 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
 %_ptr_Function_v3half = OpTypePointer Function %v3half
-         %21 = OpConstantNull %v3half
-         %22 = OpTypeFunction %v4float
+         %19 = OpConstantNull %v3half
+         %20 = OpTypeFunction %v4float
     %float_1 = OpConstant %float 1
 %trunc_103ab8 = OpFunction %void None %9
          %12 = OpLabel
-        %res = OpVariable %_ptr_Function_v3half Function %21
-         %13 = OpExtInst %v3half %16 Trunc %18
-               OpStore %res %13
+        %res = OpVariable %_ptr_Function_v3half Function %19
+               OpStore %res %16
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %22
-         %24 = OpLabel
-         %25 = OpFunctionCall %void %trunc_103ab8
+%vertex_main_inner = OpFunction %v4float None %20
+         %22 = OpLabel
+         %23 = OpFunctionCall %void %trunc_103ab8
                OpReturnValue %5
                OpFunctionEnd
 %vertex_main = OpFunction %void None %9
-         %27 = OpLabel
-         %28 = OpFunctionCall %v4float %vertex_main_inner
-               OpStore %value %28
+         %25 = OpLabel
+         %26 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %26
                OpStore %vertex_point_size %float_1
                OpReturn
                OpFunctionEnd
 %fragment_main = OpFunction %void None %9
-         %31 = OpLabel
-         %32 = OpFunctionCall %void %trunc_103ab8
+         %29 = OpLabel
+         %30 = OpFunctionCall %void %trunc_103ab8
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %trunc_103ab8
+         %32 = OpLabel
+         %33 = OpFunctionCall %void %trunc_103ab8
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.wgsl
index 260b7fa..664c63b 100644
--- a/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/103ab8.wgsl.expected.wgsl
@@ -1,7 +1,7 @@
 enable f16;
 
 fn trunc_103ab8() {
-  var res : vec3<f16> = trunc(vec3<f16>(1.0h));
+  var res : vec3<f16> = trunc(vec3<f16>(1.5h));
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/117396.wgsl b/test/tint/builtins/gen/literal/trunc/117396.wgsl
new file mode 100644
index 0000000..04ee090
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/117396.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 trunc(vec<3, fa>) -> vec<3, fa>
+fn trunc_117396() {
+  var res = trunc(vec3(1.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_117396();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_117396();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_117396();
+}
diff --git a/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..d3f4162
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_117396() {
+  float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_117396();
+  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() {
+  trunc_117396();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_117396();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..d3f4162
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_117396() {
+  float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_117396();
+  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() {
+  trunc_117396();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_117396();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.glsl
new file mode 100644
index 0000000..f81df13
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void trunc_117396() {
+  vec3 res = vec3(1.0f);
+}
+
+vec4 vertex_main() {
+  trunc_117396();
+  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 trunc_117396() {
+  vec3 res = vec3(1.0f);
+}
+
+void fragment_main() {
+  trunc_117396();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void trunc_117396() {
+  vec3 res = vec3(1.0f);
+}
+
+void compute_main() {
+  trunc_117396();
+}
+
+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/trunc/117396.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.msl
new file mode 100644
index 0000000..0fb23c3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void trunc_117396() {
+  float3 res = float3(1.0f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  trunc_117396();
+  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() {
+  trunc_117396();
+  return;
+}
+
+kernel void compute_main() {
+  trunc_117396();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.spvasm
new file mode 100644
index 0000000..9b9d61c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/117396.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 %trunc_117396 "trunc_117396"
+               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
+%trunc_117396 = 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 %trunc_117396
+               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 %trunc_117396
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %trunc_117396
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.wgsl
new file mode 100644
index 0000000..439df0c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/117396.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn trunc_117396() {
+  var res = trunc(vec3(1.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_117396();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_117396();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_117396();
+}
diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl b/test/tint/builtins/gen/literal/trunc/562d05.wgsl
index 8b5dd3f..df7c2c5 100644
--- a/test/tint/builtins/gen/literal/trunc/562d05.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl
@@ -23,7 +23,7 @@
 
 // fn trunc(vec<3, f32>) -> vec<3, f32>
 fn trunc_562d05() {
-  var res: vec3<f32> = trunc(vec3<f32>(1.f));
+  var res: vec3<f32> = trunc(vec3<f32>(1.5f));
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.dxc.hlsl
index 070bd71..23fbea5 100644
--- a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_562d05() {
-  float3 res = trunc((1.0f).xxx);
+  float3 res = (1.0f).xxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.fxc.hlsl
index 070bd71..23fbea5 100644
--- a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_562d05() {
-  float3 res = trunc((1.0f).xxx);
+  float3 res = (1.0f).xxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.glsl
index ef1026e..96d2070 100644
--- a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.glsl
@@ -1,7 +1,7 @@
 #version 310 es
 
 void trunc_562d05() {
-  vec3 res = trunc(vec3(1.0f));
+  vec3 res = vec3(1.0f);
 }
 
 vec4 vertex_main() {
@@ -21,7 +21,7 @@
 precision mediump float;
 
 void trunc_562d05() {
-  vec3 res = trunc(vec3(1.0f));
+  vec3 res = vec3(1.0f);
 }
 
 void fragment_main() {
@@ -35,7 +35,7 @@
 #version 310 es
 
 void trunc_562d05() {
-  vec3 res = trunc(vec3(1.0f));
+  vec3 res = vec3(1.0f);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.msl
index 28d2dbc..d7d1b1c 100644
--- a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_562d05() {
-  float3 res = trunc(float3(1.0f));
+  float3 res = float3(1.0f);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.spvasm
index 33af824..bee444b 100644
--- a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/trunc/562d05.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
 %trunc_562d05 = OpFunction %void None %9
          %12 = OpLabel
-        %res = OpVariable %_ptr_Function_v3float Function %20
-         %13 = OpExtInst %v3float %15 Trunc %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 %trunc_562d05
+%vertex_main_inner = OpFunction %v4float None %19
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %trunc_562d05
                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 %trunc_562d05
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %trunc_562d05
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %trunc_562d05
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %trunc_562d05
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.wgsl
index c6d3bb0..b47c581 100644
--- a/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/562d05.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
 fn trunc_562d05() {
-  var res : vec3<f32> = trunc(vec3<f32>(1.0f));
+  var res : vec3<f32> = trunc(vec3<f32>(1.5f));
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl b/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl
new file mode 100644
index 0000000..c57af89
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/7d6ded.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 trunc(fa) -> fa
+fn trunc_7d6ded() {
+  var res = trunc(1.5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_7d6ded();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_7d6ded();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_7d6ded();
+}
diff --git a/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..faba2f8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_7d6ded() {
+  float res = 1.0f;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_7d6ded();
+  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() {
+  trunc_7d6ded();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_7d6ded();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..faba2f8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_7d6ded() {
+  float res = 1.0f;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_7d6ded();
+  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() {
+  trunc_7d6ded();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_7d6ded();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.glsl
new file mode 100644
index 0000000..c25da0b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void trunc_7d6ded() {
+  float res = 1.0f;
+}
+
+vec4 vertex_main() {
+  trunc_7d6ded();
+  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 trunc_7d6ded() {
+  float res = 1.0f;
+}
+
+void fragment_main() {
+  trunc_7d6ded();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void trunc_7d6ded() {
+  float res = 1.0f;
+}
+
+void compute_main() {
+  trunc_7d6ded();
+}
+
+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/trunc/7d6ded.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.msl
new file mode 100644
index 0000000..1bf5a61
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void trunc_7d6ded() {
+  float res = 1.0f;
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  trunc_7d6ded();
+  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() {
+  trunc_7d6ded();
+  return;
+}
+
+kernel void compute_main() {
+  trunc_7d6ded();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.spvasm
new file mode 100644
index 0000000..0b3118b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/7d6ded.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 %trunc_7d6ded "trunc_7d6ded"
+               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
+%trunc_7d6ded = 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 %trunc_7d6ded
+               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 %trunc_7d6ded
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %trunc_7d6ded
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.wgsl
new file mode 100644
index 0000000..785f4b4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/7d6ded.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn trunc_7d6ded() {
+  var res = trunc(1.5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_7d6ded();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_7d6ded();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_7d6ded();
+}
diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl
index 51ea764..56f4c98 100644
--- a/test/tint/builtins/gen/literal/trunc/a56109.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl
@@ -25,7 +25,7 @@
 
 // fn trunc(vec<2, f16>) -> vec<2, f16>
 fn trunc_a56109() {
-  var res: vec2<f16> = trunc(vec2<f16>(1.h));
+  var res: vec2<f16> = trunc(vec2<f16>(1.5h));
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.dxc.hlsl
index ed119b9..0500406 100644
--- a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_a56109() {
-  vector<float16_t, 2> res = trunc((float16_t(1.0h)).xx);
+  vector<float16_t, 2> res = (float16_t(1.0h)).xx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.glsl
index 30a7a09..7ad257c 100644
--- a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_a56109() {
-  f16vec2 res = trunc(f16vec2(1.0hf));
+  f16vec2 res = f16vec2(1.0hf);
 }
 
 vec4 vertex_main() {
@@ -23,7 +23,7 @@
 precision mediump float;
 
 void trunc_a56109() {
-  f16vec2 res = trunc(f16vec2(1.0hf));
+  f16vec2 res = f16vec2(1.0hf);
 }
 
 void fragment_main() {
@@ -38,7 +38,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_a56109() {
-  f16vec2 res = trunc(f16vec2(1.0hf));
+  f16vec2 res = f16vec2(1.0hf);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.msl
index 01e9266..78261cc 100644
--- a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_a56109() {
-  half2 res = trunc(half2(1.0h));
+  half2 res = half2(1.0h);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.spvasm
index 1dc8bf3..636608a 100644
--- a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 34
 ; 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"
@@ -38,37 +37,36 @@
        %half = OpTypeFloat 16
      %v2half = OpTypeVector %half 2
 %half_0x1p_0 = OpConstant %half 0x1p+0
-         %18 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
+         %16 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
 %_ptr_Function_v2half = OpTypePointer Function %v2half
-         %21 = OpConstantNull %v2half
-         %22 = OpTypeFunction %v4float
+         %19 = OpConstantNull %v2half
+         %20 = OpTypeFunction %v4float
     %float_1 = OpConstant %float 1
 %trunc_a56109 = OpFunction %void None %9
          %12 = OpLabel
-        %res = OpVariable %_ptr_Function_v2half Function %21
-         %13 = OpExtInst %v2half %16 Trunc %18
-               OpStore %res %13
+        %res = OpVariable %_ptr_Function_v2half Function %19
+               OpStore %res %16
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %22
-         %24 = OpLabel
-         %25 = OpFunctionCall %void %trunc_a56109
+%vertex_main_inner = OpFunction %v4float None %20
+         %22 = OpLabel
+         %23 = OpFunctionCall %void %trunc_a56109
                OpReturnValue %5
                OpFunctionEnd
 %vertex_main = OpFunction %void None %9
-         %27 = OpLabel
-         %28 = OpFunctionCall %v4float %vertex_main_inner
-               OpStore %value %28
+         %25 = OpLabel
+         %26 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %26
                OpStore %vertex_point_size %float_1
                OpReturn
                OpFunctionEnd
 %fragment_main = OpFunction %void None %9
-         %31 = OpLabel
-         %32 = OpFunctionCall %void %trunc_a56109
+         %29 = OpLabel
+         %30 = OpFunctionCall %void %trunc_a56109
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %trunc_a56109
+         %32 = OpLabel
+         %33 = OpFunctionCall %void %trunc_a56109
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.wgsl
index 7051d16..06337eb 100644
--- a/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/a56109.wgsl.expected.wgsl
@@ -1,7 +1,7 @@
 enable f16;
 
 fn trunc_a56109() {
-  var res : vec2<f16> = trunc(vec2<f16>(1.0h));
+  var res : vec2<f16> = trunc(vec2<f16>(1.5h));
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/c12555.wgsl b/test/tint/builtins/gen/literal/trunc/c12555.wgsl
new file mode 100644
index 0000000..870882c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/c12555.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 trunc(vec<2, fa>) -> vec<2, fa>
+fn trunc_c12555() {
+  var res = trunc(vec2(1.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_c12555();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_c12555();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_c12555();
+}
diff --git a/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..bb9d35f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_c12555() {
+  float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_c12555();
+  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() {
+  trunc_c12555();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_c12555();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..bb9d35f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_c12555() {
+  float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_c12555();
+  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() {
+  trunc_c12555();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_c12555();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.glsl
new file mode 100644
index 0000000..bcd6a46
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void trunc_c12555() {
+  vec2 res = vec2(1.0f);
+}
+
+vec4 vertex_main() {
+  trunc_c12555();
+  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 trunc_c12555() {
+  vec2 res = vec2(1.0f);
+}
+
+void fragment_main() {
+  trunc_c12555();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void trunc_c12555() {
+  vec2 res = vec2(1.0f);
+}
+
+void compute_main() {
+  trunc_c12555();
+}
+
+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/trunc/c12555.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.msl
new file mode 100644
index 0000000..0a7ef27
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void trunc_c12555() {
+  float2 res = float2(1.0f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  trunc_c12555();
+  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() {
+  trunc_c12555();
+  return;
+}
+
+kernel void compute_main() {
+  trunc_c12555();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.spvasm
new file mode 100644
index 0000000..5b3cd3a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/c12555.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 %trunc_c12555 "trunc_c12555"
+               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
+%trunc_c12555 = 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 %trunc_c12555
+               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 %trunc_c12555
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %trunc_c12555
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.wgsl
new file mode 100644
index 0000000..a7508ca
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/c12555.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn trunc_c12555() {
+  var res = trunc(vec2(1.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_c12555();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_c12555();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_c12555();
+}
diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl
index 32f443a..bd92fb7 100644
--- a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl
@@ -25,7 +25,7 @@
 
 // fn trunc(f16) -> f16
 fn trunc_cc2b0d() {
-  var res: f16 = trunc(1.h);
+  var res: f16 = trunc(1.5h);
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.dxc.hlsl
index 92d0f9d..800b327 100644
--- a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_cc2b0d() {
-  float16_t res = trunc(float16_t(1.0h));
+  float16_t res = float16_t(1.0h);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.glsl
index 00e8be0..5dec4bf 100644
--- a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_cc2b0d() {
-  float16_t res = trunc(1.0hf);
+  float16_t res = 1.0hf;
 }
 
 vec4 vertex_main() {
@@ -23,7 +23,7 @@
 precision mediump float;
 
 void trunc_cc2b0d() {
-  float16_t res = trunc(1.0hf);
+  float16_t res = 1.0hf;
 }
 
 void fragment_main() {
@@ -38,7 +38,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_cc2b0d() {
-  float16_t res = trunc(1.0hf);
+  float16_t res = 1.0hf;
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.msl
index 785962c..3982531 100644
--- a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_cc2b0d() {
-  half res = trunc(1.0h);
+  half res = 1.0h;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.spvasm
index 71302f5..d6020f2 100644
--- a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.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
-         %15 = OpExtInstImport "GLSL.std.450"
                OpMemoryModel Logical GLSL450
                OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
                OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -38,35 +37,34 @@
        %half = OpTypeFloat 16
 %half_0x1p_0 = OpConstant %half 0x1p+0
 %_ptr_Function_half = OpTypePointer Function %half
-         %19 = OpConstantNull %half
-         %20 = OpTypeFunction %v4float
+         %17 = OpConstantNull %half
+         %18 = OpTypeFunction %v4float
     %float_1 = OpConstant %float 1
 %trunc_cc2b0d = OpFunction %void None %9
          %12 = OpLabel
-        %res = OpVariable %_ptr_Function_half Function %19
-         %13 = OpExtInst %half %15 Trunc %half_0x1p_0
-               OpStore %res %13
+        %res = OpVariable %_ptr_Function_half Function %17
+               OpStore %res %half_0x1p_0
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %20
-         %22 = OpLabel
-         %23 = OpFunctionCall %void %trunc_cc2b0d
+%vertex_main_inner = OpFunction %v4float None %18
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %trunc_cc2b0d
                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 %trunc_cc2b0d
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %trunc_cc2b0d
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %trunc_cc2b0d
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %trunc_cc2b0d
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.wgsl
index 6963297..ab1f7ad 100644
--- a/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/cc2b0d.wgsl.expected.wgsl
@@ -1,7 +1,7 @@
 enable f16;
 
 fn trunc_cc2b0d() {
-  var res : f16 = trunc(1.0h);
+  var res : f16 = trunc(1.5h);
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl
index bbc6432..33f08ad 100644
--- a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl
@@ -25,7 +25,7 @@
 
 // fn trunc(vec<4, f16>) -> vec<4, f16>
 fn trunc_ce7c17() {
-  var res: vec4<f16> = trunc(vec4<f16>(1.h));
+  var res: vec4<f16> = trunc(vec4<f16>(1.5h));
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.dxc.hlsl
index 3d1afee..de7a7a1 100644
--- a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_ce7c17() {
-  vector<float16_t, 4> res = trunc((float16_t(1.0h)).xxxx);
+  vector<float16_t, 4> res = (float16_t(1.0h)).xxxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.glsl
index 751a5a1..58a3ba8 100644
--- a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_ce7c17() {
-  f16vec4 res = trunc(f16vec4(1.0hf));
+  f16vec4 res = f16vec4(1.0hf);
 }
 
 vec4 vertex_main() {
@@ -23,7 +23,7 @@
 precision mediump float;
 
 void trunc_ce7c17() {
-  f16vec4 res = trunc(f16vec4(1.0hf));
+  f16vec4 res = f16vec4(1.0hf);
 }
 
 void fragment_main() {
@@ -38,7 +38,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_ce7c17() {
-  f16vec4 res = trunc(f16vec4(1.0hf));
+  f16vec4 res = f16vec4(1.0hf);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.msl
index 2676f2e..b5e7109 100644
--- a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_ce7c17() {
-  half4 res = trunc(half4(1.0h));
+  half4 res = half4(1.0h);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.spvasm
index 67233c5..4e38066 100644
--- a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 34
 ; 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"
@@ -38,37 +37,36 @@
        %half = OpTypeFloat 16
      %v4half = OpTypeVector %half 4
 %half_0x1p_0 = OpConstant %half 0x1p+0
-         %18 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
+         %16 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
 %_ptr_Function_v4half = OpTypePointer Function %v4half
-         %21 = OpConstantNull %v4half
-         %22 = OpTypeFunction %v4float
+         %19 = OpConstantNull %v4half
+         %20 = OpTypeFunction %v4float
     %float_1 = OpConstant %float 1
 %trunc_ce7c17 = OpFunction %void None %9
          %12 = OpLabel
-        %res = OpVariable %_ptr_Function_v4half Function %21
-         %13 = OpExtInst %v4half %16 Trunc %18
-               OpStore %res %13
+        %res = OpVariable %_ptr_Function_v4half Function %19
+               OpStore %res %16
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %22
-         %24 = OpLabel
-         %25 = OpFunctionCall %void %trunc_ce7c17
+%vertex_main_inner = OpFunction %v4float None %20
+         %22 = OpLabel
+         %23 = OpFunctionCall %void %trunc_ce7c17
                OpReturnValue %5
                OpFunctionEnd
 %vertex_main = OpFunction %void None %9
-         %27 = OpLabel
-         %28 = OpFunctionCall %v4float %vertex_main_inner
-               OpStore %value %28
+         %25 = OpLabel
+         %26 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %26
                OpStore %vertex_point_size %float_1
                OpReturn
                OpFunctionEnd
 %fragment_main = OpFunction %void None %9
-         %31 = OpLabel
-         %32 = OpFunctionCall %void %trunc_ce7c17
+         %29 = OpLabel
+         %30 = OpFunctionCall %void %trunc_ce7c17
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %trunc_ce7c17
+         %32 = OpLabel
+         %33 = OpFunctionCall %void %trunc_ce7c17
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.wgsl
index 2f491ed..4aa5e83 100644
--- a/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/ce7c17.wgsl.expected.wgsl
@@ -1,7 +1,7 @@
 enable f16;
 
 fn trunc_ce7c17() {
-  var res : vec4<f16> = trunc(vec4<f16>(1.0h));
+  var res : vec4<f16> = trunc(vec4<f16>(1.5h));
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl
index 5894d36..77ccdb2 100644
--- a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl
@@ -23,7 +23,7 @@
 
 // fn trunc(vec<4, f32>) -> vec<4, f32>
 fn trunc_e183aa() {
-  var res: vec4<f32> = trunc(vec4<f32>(1.f));
+  var res: vec4<f32> = trunc(vec4<f32>(1.5f));
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.dxc.hlsl
index a60a132..a9a6547 100644
--- a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_e183aa() {
-  float4 res = trunc((1.0f).xxxx);
+  float4 res = (1.0f).xxxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.fxc.hlsl
index a60a132..a9a6547 100644
--- a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_e183aa() {
-  float4 res = trunc((1.0f).xxxx);
+  float4 res = (1.0f).xxxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.glsl
index fe0ba3b..f820c16 100644
--- a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.glsl
@@ -1,7 +1,7 @@
 #version 310 es
 
 void trunc_e183aa() {
-  vec4 res = trunc(vec4(1.0f));
+  vec4 res = vec4(1.0f);
 }
 
 vec4 vertex_main() {
@@ -21,7 +21,7 @@
 precision mediump float;
 
 void trunc_e183aa() {
-  vec4 res = trunc(vec4(1.0f));
+  vec4 res = vec4(1.0f);
 }
 
 void fragment_main() {
@@ -35,7 +35,7 @@
 #version 310 es
 
 void trunc_e183aa() {
-  vec4 res = trunc(vec4(1.0f));
+  vec4 res = vec4(1.0f);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.msl
index 960dffd..b801d81 100644
--- a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_e183aa() {
-  float4 res = trunc(float4(1.0f));
+  float4 res = float4(1.0f);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.spvasm
index 715c2a5..5ed2379 100644
--- a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/trunc/e183aa.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
 %trunc_e183aa = OpFunction %void None %9
          %12 = OpLabel
         %res = OpVariable %_ptr_Function_v4float Function %5
-         %13 = OpExtInst %v4float %14 Trunc %16
-               OpStore %res %13
+               OpStore %res %14
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %19
-         %21 = OpLabel
-         %22 = OpFunctionCall %void %trunc_e183aa
+%vertex_main_inner = OpFunction %v4float None %17
+         %19 = OpLabel
+         %20 = OpFunctionCall %void %trunc_e183aa
                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 %trunc_e183aa
+         %25 = OpLabel
+         %26 = OpFunctionCall %void %trunc_e183aa
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %30 = OpLabel
-         %31 = OpFunctionCall %void %trunc_e183aa
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %trunc_e183aa
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.wgsl
index 00a2991..b3d734b 100644
--- a/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/e183aa.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
 fn trunc_e183aa() {
-  var res : vec4<f32> = trunc(vec4<f32>(1.0f));
+  var res : vec4<f32> = trunc(vec4<f32>(1.5f));
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl
index 6634dda..9d3490f 100644
--- a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl
@@ -23,7 +23,7 @@
 
 // fn trunc(f32) -> f32
 fn trunc_eb83df() {
-  var res: f32 = trunc(1.f);
+  var res: f32 = trunc(1.5f);
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.dxc.hlsl
index 082acc5..a539009 100644
--- a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_eb83df() {
-  float res = trunc(1.0f);
+  float res = 1.0f;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.fxc.hlsl
index 082acc5..a539009 100644
--- a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_eb83df() {
-  float res = trunc(1.0f);
+  float res = 1.0f;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.glsl
index d4b264e..dbe86ab 100644
--- a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.glsl
@@ -1,7 +1,7 @@
 #version 310 es
 
 void trunc_eb83df() {
-  float res = trunc(1.0f);
+  float res = 1.0f;
 }
 
 vec4 vertex_main() {
@@ -21,7 +21,7 @@
 precision mediump float;
 
 void trunc_eb83df() {
-  float res = trunc(1.0f);
+  float res = 1.0f;
 }
 
 void fragment_main() {
@@ -35,7 +35,7 @@
 #version 310 es
 
 void trunc_eb83df() {
-  float res = trunc(1.0f);
+  float res = 1.0f;
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.msl
index 3498d6e..da544f9 100644
--- a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_eb83df() {
-  float res = trunc(1.0f);
+  float res = 1.0f;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.spvasm
index 2152182..42b2976 100644
--- a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/trunc/eb83df.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
 %trunc_eb83df = OpFunction %void None %9
          %12 = OpLabel
         %res = OpVariable %_ptr_Function_float Function %8
-         %13 = OpExtInst %float %14 Trunc %float_1
-               OpStore %res %13
+               OpStore %res %float_1
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %18
-         %20 = OpLabel
-         %21 = OpFunctionCall %void %trunc_eb83df
+%vertex_main_inner = OpFunction %v4float None %16
+         %18 = OpLabel
+         %19 = OpFunctionCall %void %trunc_eb83df
                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 %trunc_eb83df
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %trunc_eb83df
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %29 = OpLabel
-         %30 = OpFunctionCall %void %trunc_eb83df
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %trunc_eb83df
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.wgsl
index b1207fb..b5f6d6e 100644
--- a/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/eb83df.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
 fn trunc_eb83df() {
-  var res : f32 = trunc(1.0f);
+  var res : f32 = trunc(1.5f);
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl b/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl
new file mode 100644
index 0000000..80c37aa
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/f0f1a1.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 trunc(vec<4, fa>) -> vec<4, fa>
+fn trunc_f0f1a1() {
+  var res = trunc(vec4(1.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_f0f1a1();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_f0f1a1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_f0f1a1();
+}
diff --git a/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..0db7616
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_f0f1a1() {
+  float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_f0f1a1();
+  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() {
+  trunc_f0f1a1();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_f0f1a1();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..0db7616
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_f0f1a1() {
+  float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_f0f1a1();
+  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() {
+  trunc_f0f1a1();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_f0f1a1();
+  return;
+}
diff --git a/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.glsl
new file mode 100644
index 0000000..b04c014
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void trunc_f0f1a1() {
+  vec4 res = vec4(1.0f);
+}
+
+vec4 vertex_main() {
+  trunc_f0f1a1();
+  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 trunc_f0f1a1() {
+  vec4 res = vec4(1.0f);
+}
+
+void fragment_main() {
+  trunc_f0f1a1();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void trunc_f0f1a1() {
+  vec4 res = vec4(1.0f);
+}
+
+void compute_main() {
+  trunc_f0f1a1();
+}
+
+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/trunc/f0f1a1.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.msl
new file mode 100644
index 0000000..d04242e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void trunc_f0f1a1() {
+  float4 res = float4(1.0f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  trunc_f0f1a1();
+  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() {
+  trunc_f0f1a1();
+  return;
+}
+
+kernel void compute_main() {
+  trunc_f0f1a1();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.spvasm
new file mode 100644
index 0000000..c3281d5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/f0f1a1.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 %trunc_f0f1a1 "trunc_f0f1a1"
+               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
+%trunc_f0f1a1 = 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 %trunc_f0f1a1
+               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 %trunc_f0f1a1
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %trunc_f0f1a1
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.wgsl
new file mode 100644
index 0000000..997dd99
--- /dev/null
+++ b/test/tint/builtins/gen/literal/trunc/f0f1a1.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn trunc_f0f1a1() {
+  var res = trunc(vec4(1.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_f0f1a1();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_f0f1a1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_f0f1a1();
+}
diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl
index a936cdf..6853256 100644
--- a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl
@@ -23,7 +23,7 @@
 
 // fn trunc(vec<2, f32>) -> vec<2, f32>
 fn trunc_f370d3() {
-  var res: vec2<f32> = trunc(vec2<f32>(1.f));
+  var res: vec2<f32> = trunc(vec2<f32>(1.5f));
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.dxc.hlsl
index 8e7b9d7..76ca41a 100644
--- a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_f370d3() {
-  float2 res = trunc((1.0f).xx);
+  float2 res = (1.0f).xx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.fxc.hlsl
index 8e7b9d7..76ca41a 100644
--- a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_f370d3() {
-  float2 res = trunc((1.0f).xx);
+  float2 res = (1.0f).xx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.glsl
index ff8b53f..1e4aaf9 100644
--- a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.glsl
@@ -1,7 +1,7 @@
 #version 310 es
 
 void trunc_f370d3() {
-  vec2 res = trunc(vec2(1.0f));
+  vec2 res = vec2(1.0f);
 }
 
 vec4 vertex_main() {
@@ -21,7 +21,7 @@
 precision mediump float;
 
 void trunc_f370d3() {
-  vec2 res = trunc(vec2(1.0f));
+  vec2 res = vec2(1.0f);
 }
 
 void fragment_main() {
@@ -35,7 +35,7 @@
 #version 310 es
 
 void trunc_f370d3() {
-  vec2 res = trunc(vec2(1.0f));
+  vec2 res = vec2(1.0f);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.msl b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.msl
index ae71a0a..ceac6e4 100644
--- a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_f370d3() {
-  float2 res = trunc(float2(1.0f));
+  float2 res = float2(1.0f);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.spvasm
index 07e4e38..2f2f61a 100644
--- a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/trunc/f370d3.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
 %trunc_f370d3 = OpFunction %void None %9
          %12 = OpLabel
-        %res = OpVariable %_ptr_Function_v2float Function %20
-         %13 = OpExtInst %v2float %15 Trunc %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 %trunc_f370d3
+%vertex_main_inner = OpFunction %v4float None %19
+         %21 = OpLabel
+         %22 = OpFunctionCall %void %trunc_f370d3
                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 %trunc_f370d3
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %trunc_f370d3
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %trunc_f370d3
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %trunc_f370d3
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.wgsl
index 75b84d8..8dad61f 100644
--- a/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/trunc/f370d3.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
 fn trunc_f370d3() {
-  var res : vec2<f32> = trunc(vec2<f32>(1.0f));
+  var res : vec2<f32> = trunc(vec2<f32>(1.5f));
 }
 
 @vertex
diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl
index 09e2de3..b1c2ecb 100644
--- a/test/tint/builtins/gen/var/trunc/103ab8.wgsl
+++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl
@@ -25,7 +25,7 @@
 
 // fn trunc(vec<3, f16>) -> vec<3, f16>
 fn trunc_103ab8() {
-  var arg_0 = vec3<f16>(1.h);
+  var arg_0 = vec3<f16>(1.5h);
   var res: vec3<f16> = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.dxc.hlsl
index ddbd6d2..8eb5c91 100644
--- a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_103ab8() {
-  vector<float16_t, 3> arg_0 = (float16_t(1.0h)).xxx;
+  vector<float16_t, 3> arg_0 = (float16_t(1.5h)).xxx;
   vector<float16_t, 3> res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.glsl
index ffb099f..bb2e9a7 100644
--- a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_103ab8() {
-  f16vec3 arg_0 = f16vec3(1.0hf);
+  f16vec3 arg_0 = f16vec3(1.5hf);
   f16vec3 res = trunc(arg_0);
 }
 
@@ -24,7 +24,7 @@
 precision mediump float;
 
 void trunc_103ab8() {
-  f16vec3 arg_0 = f16vec3(1.0hf);
+  f16vec3 arg_0 = f16vec3(1.5hf);
   f16vec3 res = trunc(arg_0);
 }
 
@@ -40,7 +40,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_103ab8() {
-  f16vec3 arg_0 = f16vec3(1.0hf);
+  f16vec3 arg_0 = f16vec3(1.5hf);
   f16vec3 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.msl
index 22056f0..4e3f505 100644
--- a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_103ab8() {
-  half3 arg_0 = half3(1.0h);
+  half3 arg_0 = half3(1.5h);
   half3 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.spvasm
index 91192b4..e6b9a38 100644
--- a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.spvasm
@@ -38,8 +38,8 @@
           %9 = OpTypeFunction %void
        %half = OpTypeFloat 16
      %v3half = OpTypeVector %half 3
-%half_0x1p_0 = OpConstant %half 0x1p+0
-         %16 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
+%half_0x1_8p_0 = OpConstant %half 0x1.8p+0
+         %16 = OpConstantComposite %v3half %half_0x1_8p_0 %half_0x1_8p_0 %half_0x1_8p_0
 %_ptr_Function_v3half = OpTypePointer Function %v3half
          %19 = OpConstantNull %v3half
          %24 = OpTypeFunction %v4float
diff --git a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.wgsl
index dc42691..8ccaf01 100644
--- a/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/trunc/103ab8.wgsl.expected.wgsl
@@ -1,7 +1,7 @@
 enable f16;
 
 fn trunc_103ab8() {
-  var arg_0 = vec3<f16>(1.0h);
+  var arg_0 = vec3<f16>(1.5h);
   var res : vec3<f16> = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/117396.wgsl b/test/tint/builtins/gen/var/trunc/117396.wgsl
new file mode 100644
index 0000000..811ba78
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/117396.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 trunc(vec<3, fa>) -> vec<3, fa>
+fn trunc_117396() {
+  const arg_0 = vec3(1.5);
+  var res = trunc(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_117396();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_117396();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_117396();
+}
diff --git a/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..d3f4162
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_117396() {
+  float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_117396();
+  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() {
+  trunc_117396();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_117396();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..d3f4162
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_117396() {
+  float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_117396();
+  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() {
+  trunc_117396();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_117396();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.glsl
new file mode 100644
index 0000000..f81df13
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void trunc_117396() {
+  vec3 res = vec3(1.0f);
+}
+
+vec4 vertex_main() {
+  trunc_117396();
+  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 trunc_117396() {
+  vec3 res = vec3(1.0f);
+}
+
+void fragment_main() {
+  trunc_117396();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void trunc_117396() {
+  vec3 res = vec3(1.0f);
+}
+
+void compute_main() {
+  trunc_117396();
+}
+
+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/trunc/117396.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.msl
new file mode 100644
index 0000000..0fb23c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void trunc_117396() {
+  float3 res = float3(1.0f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  trunc_117396();
+  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() {
+  trunc_117396();
+  return;
+}
+
+kernel void compute_main() {
+  trunc_117396();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.spvasm
new file mode 100644
index 0000000..9b9d61c
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/117396.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 %trunc_117396 "trunc_117396"
+               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
+%trunc_117396 = 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 %trunc_117396
+               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 %trunc_117396
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %trunc_117396
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.wgsl
new file mode 100644
index 0000000..39fdc96
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/117396.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn trunc_117396() {
+  const arg_0 = vec3(1.5);
+  var res = trunc(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_117396();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_117396();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_117396();
+}
diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl
index 14bc4a6..de79b2a 100644
--- a/test/tint/builtins/gen/var/trunc/562d05.wgsl
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl
@@ -23,7 +23,7 @@
 
 // fn trunc(vec<3, f32>) -> vec<3, f32>
 fn trunc_562d05() {
-  var arg_0 = vec3<f32>(1.f);
+  var arg_0 = vec3<f32>(1.5f);
   var res: vec3<f32> = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.dxc.hlsl
index 685ad83..bee4949 100644
--- a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_562d05() {
-  float3 arg_0 = (1.0f).xxx;
+  float3 arg_0 = (1.5f).xxx;
   float3 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.fxc.hlsl
index 685ad83..bee4949 100644
--- a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_562d05() {
-  float3 arg_0 = (1.0f).xxx;
+  float3 arg_0 = (1.5f).xxx;
   float3 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl
index 7b2bc3c..697c356 100644
--- a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl
@@ -1,7 +1,7 @@
 #version 310 es
 
 void trunc_562d05() {
-  vec3 arg_0 = vec3(1.0f);
+  vec3 arg_0 = vec3(1.5f);
   vec3 res = trunc(arg_0);
 }
 
@@ -22,7 +22,7 @@
 precision mediump float;
 
 void trunc_562d05() {
-  vec3 arg_0 = vec3(1.0f);
+  vec3 arg_0 = vec3(1.5f);
   vec3 res = trunc(arg_0);
 }
 
@@ -37,7 +37,7 @@
 #version 310 es
 
 void trunc_562d05() {
-  vec3 arg_0 = vec3(1.0f);
+  vec3 arg_0 = vec3(1.5f);
   vec3 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl
index e5632e6..a81ade2 100644
--- a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_562d05() {
-  float3 arg_0 = float3(1.0f);
+  float3 arg_0 = float3(1.5f);
   float3 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm
index f5f5288..4985ca8 100644
--- a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 37
 ; Schema: 0
                OpCapability Shader
          %20 = OpExtInstImport "GLSL.std.450"
@@ -33,11 +33,12 @@
        %void = OpTypeVoid
           %9 = OpTypeFunction %void
     %v3float = OpTypeVector %float 3
-    %float_1 = OpConstant %float 1
-         %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+  %float_1_5 = OpConstant %float 1.5
+         %15 = OpConstantComposite %v3float %float_1_5 %float_1_5 %float_1_5
 %_ptr_Function_v3float = OpTypePointer Function %v3float
          %18 = OpConstantNull %v3float
          %23 = OpTypeFunction %v4float
+    %float_1 = OpConstant %float 1
 %trunc_562d05 = OpFunction %void None %9
          %12 = OpLabel
       %arg_0 = OpVariable %_ptr_Function_v3float Function %18
@@ -61,12 +62,12 @@
                OpReturn
                OpFunctionEnd
 %fragment_main = OpFunction %void None %9
-         %31 = OpLabel
-         %32 = OpFunctionCall %void %trunc_562d05
+         %32 = OpLabel
+         %33 = OpFunctionCall %void %trunc_562d05
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %trunc_562d05
+         %35 = OpLabel
+         %36 = OpFunctionCall %void %trunc_562d05
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl
index f005830..fce6311b 100644
--- a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
 fn trunc_562d05() {
-  var arg_0 = vec3<f32>(1.0f);
+  var arg_0 = vec3<f32>(1.5f);
   var res : vec3<f32> = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/7d6ded.wgsl b/test/tint/builtins/gen/var/trunc/7d6ded.wgsl
new file mode 100644
index 0000000..ef22069
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/7d6ded.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 trunc(fa) -> fa
+fn trunc_7d6ded() {
+  const arg_0 = 1.5;
+  var res = trunc(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_7d6ded();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_7d6ded();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_7d6ded();
+}
diff --git a/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..faba2f8
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_7d6ded() {
+  float res = 1.0f;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_7d6ded();
+  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() {
+  trunc_7d6ded();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_7d6ded();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..faba2f8
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_7d6ded() {
+  float res = 1.0f;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_7d6ded();
+  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() {
+  trunc_7d6ded();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_7d6ded();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.glsl
new file mode 100644
index 0000000..c25da0b
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void trunc_7d6ded() {
+  float res = 1.0f;
+}
+
+vec4 vertex_main() {
+  trunc_7d6ded();
+  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 trunc_7d6ded() {
+  float res = 1.0f;
+}
+
+void fragment_main() {
+  trunc_7d6ded();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void trunc_7d6ded() {
+  float res = 1.0f;
+}
+
+void compute_main() {
+  trunc_7d6ded();
+}
+
+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/trunc/7d6ded.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.msl
new file mode 100644
index 0000000..1bf5a61
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void trunc_7d6ded() {
+  float res = 1.0f;
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  trunc_7d6ded();
+  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() {
+  trunc_7d6ded();
+  return;
+}
+
+kernel void compute_main() {
+  trunc_7d6ded();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.spvasm
new file mode 100644
index 0000000..0b3118b
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/7d6ded.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 %trunc_7d6ded "trunc_7d6ded"
+               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
+%trunc_7d6ded = 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 %trunc_7d6ded
+               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 %trunc_7d6ded
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %trunc_7d6ded
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.wgsl
new file mode 100644
index 0000000..e4cfb9c
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/7d6ded.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn trunc_7d6ded() {
+  const arg_0 = 1.5;
+  var res = trunc(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_7d6ded();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_7d6ded();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_7d6ded();
+}
diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl
index 4e6b5b1..b7604e3 100644
--- a/test/tint/builtins/gen/var/trunc/a56109.wgsl
+++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl
@@ -25,7 +25,7 @@
 
 // fn trunc(vec<2, f16>) -> vec<2, f16>
 fn trunc_a56109() {
-  var arg_0 = vec2<f16>(1.h);
+  var arg_0 = vec2<f16>(1.5h);
   var res: vec2<f16> = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.dxc.hlsl
index 059dfcf..64f93d2 100644
--- a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_a56109() {
-  vector<float16_t, 2> arg_0 = (float16_t(1.0h)).xx;
+  vector<float16_t, 2> arg_0 = (float16_t(1.5h)).xx;
   vector<float16_t, 2> res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.glsl
index 3855c864..5e8431c 100644
--- a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_a56109() {
-  f16vec2 arg_0 = f16vec2(1.0hf);
+  f16vec2 arg_0 = f16vec2(1.5hf);
   f16vec2 res = trunc(arg_0);
 }
 
@@ -24,7 +24,7 @@
 precision mediump float;
 
 void trunc_a56109() {
-  f16vec2 arg_0 = f16vec2(1.0hf);
+  f16vec2 arg_0 = f16vec2(1.5hf);
   f16vec2 res = trunc(arg_0);
 }
 
@@ -40,7 +40,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_a56109() {
-  f16vec2 arg_0 = f16vec2(1.0hf);
+  f16vec2 arg_0 = f16vec2(1.5hf);
   f16vec2 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.msl
index 38660ec..0ee977d 100644
--- a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_a56109() {
-  half2 arg_0 = half2(1.0h);
+  half2 arg_0 = half2(1.5h);
   half2 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.spvasm
index c7d0941..c9553ad 100644
--- a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.spvasm
@@ -38,8 +38,8 @@
           %9 = OpTypeFunction %void
        %half = OpTypeFloat 16
      %v2half = OpTypeVector %half 2
-%half_0x1p_0 = OpConstant %half 0x1p+0
-         %16 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
+%half_0x1_8p_0 = OpConstant %half 0x1.8p+0
+         %16 = OpConstantComposite %v2half %half_0x1_8p_0 %half_0x1_8p_0
 %_ptr_Function_v2half = OpTypePointer Function %v2half
          %19 = OpConstantNull %v2half
          %24 = OpTypeFunction %v4float
diff --git a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.wgsl
index 71aabc5..e22e108 100644
--- a/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/trunc/a56109.wgsl.expected.wgsl
@@ -1,7 +1,7 @@
 enable f16;
 
 fn trunc_a56109() {
-  var arg_0 = vec2<f16>(1.0h);
+  var arg_0 = vec2<f16>(1.5h);
   var res : vec2<f16> = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/c12555.wgsl b/test/tint/builtins/gen/var/trunc/c12555.wgsl
new file mode 100644
index 0000000..7091415
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/c12555.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 trunc(vec<2, fa>) -> vec<2, fa>
+fn trunc_c12555() {
+  const arg_0 = vec2(1.5);
+  var res = trunc(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_c12555();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_c12555();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_c12555();
+}
diff --git a/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..bb9d35f
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_c12555() {
+  float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_c12555();
+  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() {
+  trunc_c12555();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_c12555();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..bb9d35f
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_c12555() {
+  float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_c12555();
+  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() {
+  trunc_c12555();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_c12555();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.glsl
new file mode 100644
index 0000000..bcd6a46
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void trunc_c12555() {
+  vec2 res = vec2(1.0f);
+}
+
+vec4 vertex_main() {
+  trunc_c12555();
+  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 trunc_c12555() {
+  vec2 res = vec2(1.0f);
+}
+
+void fragment_main() {
+  trunc_c12555();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void trunc_c12555() {
+  vec2 res = vec2(1.0f);
+}
+
+void compute_main() {
+  trunc_c12555();
+}
+
+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/trunc/c12555.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.msl
new file mode 100644
index 0000000..0a7ef27
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void trunc_c12555() {
+  float2 res = float2(1.0f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  trunc_c12555();
+  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() {
+  trunc_c12555();
+  return;
+}
+
+kernel void compute_main() {
+  trunc_c12555();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.spvasm
new file mode 100644
index 0000000..5b3cd3a
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/c12555.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 %trunc_c12555 "trunc_c12555"
+               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
+%trunc_c12555 = 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 %trunc_c12555
+               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 %trunc_c12555
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %trunc_c12555
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.wgsl
new file mode 100644
index 0000000..069e7cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/c12555.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn trunc_c12555() {
+  const arg_0 = vec2(1.5);
+  var res = trunc(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_c12555();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_c12555();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_c12555();
+}
diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl
index ee4f839..8af04dd 100644
--- a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl
+++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl
@@ -25,7 +25,7 @@
 
 // fn trunc(f16) -> f16
 fn trunc_cc2b0d() {
-  var arg_0 = 1.h;
+  var arg_0 = 1.5h;
   var res: f16 = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.dxc.hlsl
index 8f1a6af..6c318d0 100644
--- a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_cc2b0d() {
-  float16_t arg_0 = float16_t(1.0h);
+  float16_t arg_0 = float16_t(1.5h);
   float16_t res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.glsl
index f0e9d9c..fa17dcb 100644
--- a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_cc2b0d() {
-  float16_t arg_0 = 1.0hf;
+  float16_t arg_0 = 1.5hf;
   float16_t res = trunc(arg_0);
 }
 
@@ -24,7 +24,7 @@
 precision mediump float;
 
 void trunc_cc2b0d() {
-  float16_t arg_0 = 1.0hf;
+  float16_t arg_0 = 1.5hf;
   float16_t res = trunc(arg_0);
 }
 
@@ -40,7 +40,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_cc2b0d() {
-  float16_t arg_0 = 1.0hf;
+  float16_t arg_0 = 1.5hf;
   float16_t res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.msl
index 25fd8e1..77638e3 100644
--- a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_cc2b0d() {
-  half arg_0 = 1.0h;
+  half arg_0 = 1.5h;
   half res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.spvasm
index 1266beb..9c8859b 100644
--- a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.spvasm
@@ -37,7 +37,7 @@
        %void = OpTypeVoid
           %9 = OpTypeFunction %void
        %half = OpTypeFloat 16
-%half_0x1p_0 = OpConstant %half 0x1p+0
+%half_0x1_8p_0 = OpConstant %half 0x1.8p+0
 %_ptr_Function_half = OpTypePointer Function %half
          %17 = OpConstantNull %half
          %22 = OpTypeFunction %v4float
@@ -46,7 +46,7 @@
          %12 = OpLabel
       %arg_0 = OpVariable %_ptr_Function_half Function %17
         %res = OpVariable %_ptr_Function_half Function %17
-               OpStore %arg_0 %half_0x1p_0
+               OpStore %arg_0 %half_0x1_8p_0
          %20 = OpLoad %half %arg_0
          %18 = OpExtInst %half %19 Trunc %20
                OpStore %res %18
diff --git a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.wgsl
index cc68f29..f943aa7 100644
--- a/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/trunc/cc2b0d.wgsl.expected.wgsl
@@ -1,7 +1,7 @@
 enable f16;
 
 fn trunc_cc2b0d() {
-  var arg_0 = 1.0h;
+  var arg_0 = 1.5h;
   var res : f16 = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl
index be36c02..06955c3 100644
--- a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl
+++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl
@@ -25,7 +25,7 @@
 
 // fn trunc(vec<4, f16>) -> vec<4, f16>
 fn trunc_ce7c17() {
-  var arg_0 = vec4<f16>(1.h);
+  var arg_0 = vec4<f16>(1.5h);
   var res: vec4<f16> = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.dxc.hlsl
index fedd729..adfdbc2 100644
--- a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_ce7c17() {
-  vector<float16_t, 4> arg_0 = (float16_t(1.0h)).xxxx;
+  vector<float16_t, 4> arg_0 = (float16_t(1.5h)).xxxx;
   vector<float16_t, 4> res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.glsl
index 6b65996..f1fca58 100644
--- a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.glsl
@@ -2,7 +2,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_ce7c17() {
-  f16vec4 arg_0 = f16vec4(1.0hf);
+  f16vec4 arg_0 = f16vec4(1.5hf);
   f16vec4 res = trunc(arg_0);
 }
 
@@ -24,7 +24,7 @@
 precision mediump float;
 
 void trunc_ce7c17() {
-  f16vec4 arg_0 = f16vec4(1.0hf);
+  f16vec4 arg_0 = f16vec4(1.5hf);
   f16vec4 res = trunc(arg_0);
 }
 
@@ -40,7 +40,7 @@
 #extension GL_AMD_gpu_shader_half_float : require
 
 void trunc_ce7c17() {
-  f16vec4 arg_0 = f16vec4(1.0hf);
+  f16vec4 arg_0 = f16vec4(1.5hf);
   f16vec4 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.msl
index f3f90c4..b5e9d81 100644
--- a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_ce7c17() {
-  half4 arg_0 = half4(1.0h);
+  half4 arg_0 = half4(1.5h);
   half4 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.spvasm
index 91cad17..f8e77e7 100644
--- a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.spvasm
@@ -38,8 +38,8 @@
           %9 = OpTypeFunction %void
        %half = OpTypeFloat 16
      %v4half = OpTypeVector %half 4
-%half_0x1p_0 = OpConstant %half 0x1p+0
-         %16 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
+%half_0x1_8p_0 = OpConstant %half 0x1.8p+0
+         %16 = OpConstantComposite %v4half %half_0x1_8p_0 %half_0x1_8p_0 %half_0x1_8p_0 %half_0x1_8p_0
 %_ptr_Function_v4half = OpTypePointer Function %v4half
          %19 = OpConstantNull %v4half
          %24 = OpTypeFunction %v4float
diff --git a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.wgsl
index 8fa5b3b..bdf34ff 100644
--- a/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/trunc/ce7c17.wgsl.expected.wgsl
@@ -1,7 +1,7 @@
 enable f16;
 
 fn trunc_ce7c17() {
-  var arg_0 = vec4<f16>(1.0h);
+  var arg_0 = vec4<f16>(1.5h);
   var res : vec4<f16> = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl
index c21a06b..b3cab10 100644
--- a/test/tint/builtins/gen/var/trunc/e183aa.wgsl
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl
@@ -23,7 +23,7 @@
 
 // fn trunc(vec<4, f32>) -> vec<4, f32>
 fn trunc_e183aa() {
-  var arg_0 = vec4<f32>(1.f);
+  var arg_0 = vec4<f32>(1.5f);
   var res: vec4<f32> = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.dxc.hlsl
index 10af761..86604bd 100644
--- a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_e183aa() {
-  float4 arg_0 = (1.0f).xxxx;
+  float4 arg_0 = (1.5f).xxxx;
   float4 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.fxc.hlsl
index 10af761..86604bd 100644
--- a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_e183aa() {
-  float4 arg_0 = (1.0f).xxxx;
+  float4 arg_0 = (1.5f).xxxx;
   float4 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl
index efb9d97..abed6a6 100644
--- a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl
@@ -1,7 +1,7 @@
 #version 310 es
 
 void trunc_e183aa() {
-  vec4 arg_0 = vec4(1.0f);
+  vec4 arg_0 = vec4(1.5f);
   vec4 res = trunc(arg_0);
 }
 
@@ -22,7 +22,7 @@
 precision mediump float;
 
 void trunc_e183aa() {
-  vec4 arg_0 = vec4(1.0f);
+  vec4 arg_0 = vec4(1.5f);
   vec4 res = trunc(arg_0);
 }
 
@@ -37,7 +37,7 @@
 #version 310 es
 
 void trunc_e183aa() {
-  vec4 arg_0 = vec4(1.0f);
+  vec4 arg_0 = vec4(1.5f);
   vec4 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl
index 4820d6c..4e3992b 100644
--- a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_e183aa() {
-  float4 arg_0 = float4(1.0f);
+  float4 arg_0 = float4(1.5f);
   float4 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm
index 565159a..bfc9dd8 100644
--- a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 35
 ; Schema: 0
                OpCapability Shader
          %18 = OpExtInstImport "GLSL.std.450"
@@ -32,10 +32,11 @@
 %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
+  %float_1_5 = OpConstant %float 1.5
+         %14 = OpConstantComposite %v4float %float_1_5 %float_1_5 %float_1_5 %float_1_5
 %_ptr_Function_v4float = OpTypePointer Function %v4float
          %21 = OpTypeFunction %v4float
+    %float_1 = OpConstant %float 1
 %trunc_e183aa = OpFunction %void None %9
          %12 = OpLabel
       %arg_0 = OpVariable %_ptr_Function_v4float Function %5
@@ -59,12 +60,12 @@
                OpReturn
                OpFunctionEnd
 %fragment_main = OpFunction %void None %9
-         %29 = OpLabel
-         %30 = OpFunctionCall %void %trunc_e183aa
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %trunc_e183aa
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %32 = OpLabel
-         %33 = OpFunctionCall %void %trunc_e183aa
+         %33 = OpLabel
+         %34 = OpFunctionCall %void %trunc_e183aa
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl
index f1f1db3..3aba18f 100644
--- a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
 fn trunc_e183aa() {
-  var arg_0 = vec4<f32>(1.0f);
+  var arg_0 = vec4<f32>(1.5f);
   var res : vec4<f32> = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl
index 8ac0bdb..5ea7bcd 100644
--- a/test/tint/builtins/gen/var/trunc/eb83df.wgsl
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl
@@ -23,7 +23,7 @@
 
 // fn trunc(f32) -> f32
 fn trunc_eb83df() {
-  var arg_0 = 1.f;
+  var arg_0 = 1.5f;
   var res: f32 = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.dxc.hlsl
index 7f13d9a..1056d4f 100644
--- a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_eb83df() {
-  float arg_0 = 1.0f;
+  float arg_0 = 1.5f;
   float res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.fxc.hlsl
index 7f13d9a..1056d4f 100644
--- a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_eb83df() {
-  float arg_0 = 1.0f;
+  float arg_0 = 1.5f;
   float res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl
index 57e9bd8..2baaf2d 100644
--- a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl
@@ -1,7 +1,7 @@
 #version 310 es
 
 void trunc_eb83df() {
-  float arg_0 = 1.0f;
+  float arg_0 = 1.5f;
   float res = trunc(arg_0);
 }
 
@@ -22,7 +22,7 @@
 precision mediump float;
 
 void trunc_eb83df() {
-  float arg_0 = 1.0f;
+  float arg_0 = 1.5f;
   float res = trunc(arg_0);
 }
 
@@ -37,7 +37,7 @@
 #version 310 es
 
 void trunc_eb83df() {
-  float arg_0 = 1.0f;
+  float arg_0 = 1.5f;
   float res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl
index 2408d6c..1f4dab6 100644
--- a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_eb83df() {
-  float arg_0 = 1.0f;
+  float arg_0 = 1.5f;
   float res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm
index f5fa2a2..15a7d6d 100644
--- a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 33
+; Bound: 34
 ; Schema: 0
                OpCapability Shader
          %17 = OpExtInstImport "GLSL.std.450"
@@ -32,14 +32,15 @@
 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
        %void = OpTypeVoid
           %9 = OpTypeFunction %void
-    %float_1 = OpConstant %float 1
+  %float_1_5 = OpConstant %float 1.5
 %_ptr_Function_float = OpTypePointer Function %float
          %20 = OpTypeFunction %v4float
+    %float_1 = OpConstant %float 1
 %trunc_eb83df = OpFunction %void None %9
          %12 = OpLabel
       %arg_0 = OpVariable %_ptr_Function_float Function %8
         %res = OpVariable %_ptr_Function_float Function %8
-               OpStore %arg_0 %float_1
+               OpStore %arg_0 %float_1_5
          %18 = OpLoad %float %arg_0
          %16 = OpExtInst %float %17 Trunc %18
                OpStore %res %16
@@ -58,12 +59,12 @@
                OpReturn
                OpFunctionEnd
 %fragment_main = OpFunction %void None %9
-         %28 = OpLabel
-         %29 = OpFunctionCall %void %trunc_eb83df
+         %29 = OpLabel
+         %30 = OpFunctionCall %void %trunc_eb83df
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %31 = OpLabel
-         %32 = OpFunctionCall %void %trunc_eb83df
+         %32 = OpLabel
+         %33 = OpFunctionCall %void %trunc_eb83df
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl
index ae1518f..6cb3f54 100644
--- a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
 fn trunc_eb83df() {
-  var arg_0 = 1.0f;
+  var arg_0 = 1.5f;
   var res : f32 = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl b/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl
new file mode 100644
index 0000000..720789c
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f0f1a1.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 trunc(vec<4, fa>) -> vec<4, fa>
+fn trunc_f0f1a1() {
+  const arg_0 = vec4(1.5);
+  var res = trunc(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_f0f1a1();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_f0f1a1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_f0f1a1();
+}
diff --git a/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..0db7616
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_f0f1a1() {
+  float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_f0f1a1();
+  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() {
+  trunc_f0f1a1();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_f0f1a1();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..0db7616
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void trunc_f0f1a1() {
+  float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+  float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+  trunc_f0f1a1();
+  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() {
+  trunc_f0f1a1();
+  return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+  trunc_f0f1a1();
+  return;
+}
diff --git a/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.glsl
new file mode 100644
index 0000000..b04c014
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void trunc_f0f1a1() {
+  vec4 res = vec4(1.0f);
+}
+
+vec4 vertex_main() {
+  trunc_f0f1a1();
+  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 trunc_f0f1a1() {
+  vec4 res = vec4(1.0f);
+}
+
+void fragment_main() {
+  trunc_f0f1a1();
+}
+
+void main() {
+  fragment_main();
+  return;
+}
+#version 310 es
+
+void trunc_f0f1a1() {
+  vec4 res = vec4(1.0f);
+}
+
+void compute_main() {
+  trunc_f0f1a1();
+}
+
+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/trunc/f0f1a1.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.msl
new file mode 100644
index 0000000..d04242e
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void trunc_f0f1a1() {
+  float4 res = float4(1.0f);
+}
+
+struct tint_symbol {
+  float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+  trunc_f0f1a1();
+  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() {
+  trunc_f0f1a1();
+  return;
+}
+
+kernel void compute_main() {
+  trunc_f0f1a1();
+  return;
+}
+
diff --git a/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.spvasm
new file mode 100644
index 0000000..c3281d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f0f1a1.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 %trunc_f0f1a1 "trunc_f0f1a1"
+               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
+%trunc_f0f1a1 = 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 %trunc_f0f1a1
+               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 %trunc_f0f1a1
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %9
+         %28 = OpLabel
+         %29 = OpFunctionCall %void %trunc_f0f1a1
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.wgsl
new file mode 100644
index 0000000..3166920
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f0f1a1.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn trunc_f0f1a1() {
+  const arg_0 = vec4(1.5);
+  var res = trunc(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+  trunc_f0f1a1();
+  return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+  trunc_f0f1a1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+  trunc_f0f1a1();
+}
diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl
index 7915956..843d598 100644
--- a/test/tint/builtins/gen/var/trunc/f370d3.wgsl
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl
@@ -23,7 +23,7 @@
 
 // fn trunc(vec<2, f32>) -> vec<2, f32>
 fn trunc_f370d3() {
-  var arg_0 = vec2<f32>(1.f);
+  var arg_0 = vec2<f32>(1.5f);
   var res: vec2<f32> = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.dxc.hlsl
index 5f59f24..4763fd8 100644
--- a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_f370d3() {
-  float2 arg_0 = (1.0f).xx;
+  float2 arg_0 = (1.5f).xx;
   float2 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.fxc.hlsl
index 5f59f24..4763fd8 100644
--- a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
 void trunc_f370d3() {
-  float2 arg_0 = (1.0f).xx;
+  float2 arg_0 = (1.5f).xx;
   float2 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl
index a850df2..9ab35b5 100644
--- a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl
@@ -1,7 +1,7 @@
 #version 310 es
 
 void trunc_f370d3() {
-  vec2 arg_0 = vec2(1.0f);
+  vec2 arg_0 = vec2(1.5f);
   vec2 res = trunc(arg_0);
 }
 
@@ -22,7 +22,7 @@
 precision mediump float;
 
 void trunc_f370d3() {
-  vec2 arg_0 = vec2(1.0f);
+  vec2 arg_0 = vec2(1.5f);
   vec2 res = trunc(arg_0);
 }
 
@@ -37,7 +37,7 @@
 #version 310 es
 
 void trunc_f370d3() {
-  vec2 arg_0 = vec2(1.0f);
+  vec2 arg_0 = vec2(1.5f);
   vec2 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl
index fdce7c2..074922c 100644
--- a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl
@@ -2,7 +2,7 @@
 
 using namespace metal;
 void trunc_f370d3() {
-  float2 arg_0 = float2(1.0f);
+  float2 arg_0 = float2(1.5f);
   float2 res = trunc(arg_0);
 }
 
diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm
index 3736cd6..917f79e 100644
--- a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 37
 ; Schema: 0
                OpCapability Shader
          %20 = OpExtInstImport "GLSL.std.450"
@@ -33,11 +33,12 @@
        %void = OpTypeVoid
           %9 = OpTypeFunction %void
     %v2float = OpTypeVector %float 2
-    %float_1 = OpConstant %float 1
-         %15 = OpConstantComposite %v2float %float_1 %float_1
+  %float_1_5 = OpConstant %float 1.5
+         %15 = OpConstantComposite %v2float %float_1_5 %float_1_5
 %_ptr_Function_v2float = OpTypePointer Function %v2float
          %18 = OpConstantNull %v2float
          %23 = OpTypeFunction %v4float
+    %float_1 = OpConstant %float 1
 %trunc_f370d3 = OpFunction %void None %9
          %12 = OpLabel
       %arg_0 = OpVariable %_ptr_Function_v2float Function %18
@@ -61,12 +62,12 @@
                OpReturn
                OpFunctionEnd
 %fragment_main = OpFunction %void None %9
-         %31 = OpLabel
-         %32 = OpFunctionCall %void %trunc_f370d3
+         %32 = OpLabel
+         %33 = OpFunctionCall %void %trunc_f370d3
                OpReturn
                OpFunctionEnd
 %compute_main = OpFunction %void None %9
-         %34 = OpLabel
-         %35 = OpFunctionCall %void %trunc_f370d3
+         %35 = OpLabel
+         %36 = OpFunctionCall %void %trunc_f370d3
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl
index 537761f..5fe9aac 100644
--- a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
 fn trunc_f370d3() {
-  var arg_0 = vec2<f32>(1.0f);
+  var arg_0 = vec2<f32>(1.5f);
   var res : vec2<f32> = trunc(arg_0);
 }