tint: const eval of firstLeadingBit

Bug: tint:1581
Change-Id: I33c87ced173938bcd16e00debdd5c6682b4a9426
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107763
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def
index d3d01e6..4bed6b9 100644
--- a/src/tint/intrinsics.def
+++ b/src/tint/intrinsics.def
@@ -467,8 +467,8 @@
 fn extractBits<T: iu32>(T, u32, u32) -> T
 fn extractBits<N: num, T: iu32>(vec<N, T>, u32, u32) -> vec<N, T>
 fn faceForward<N: num, T: f32_f16>(vec<N, T>, vec<N, T>, vec<N, T>) -> vec<N, T>
-fn firstLeadingBit<T: iu32>(T) -> T
-fn firstLeadingBit<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
+@const fn firstLeadingBit<T: iu32>(T) -> T
+@const fn firstLeadingBit<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
 fn firstTrailingBit<T: iu32>(T) -> T
 fn firstTrailingBit<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
 fn floor<T: f32_f16>(T) -> T
diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc
index 83998c0..efe7b8b 100644
--- a/src/tint/resolver/const_eval.cc
+++ b/src/tint/resolver/const_eval.cc
@@ -192,6 +192,23 @@
     return ss.str();
 }
 
+/// @returns the number of consecutive leading bits in `@p e` set to `@p bit_value_to_count`.
+template <typename T>
+auto CountLeadingBits(T e, T bit_value_to_count) -> std::make_unsigned_t<T> {
+    using UT = std::make_unsigned_t<T>;
+    constexpr UT kNumBits = sizeof(UT) * 8;
+    constexpr UT kLeftMost = UT{1} << (kNumBits - 1);
+    const UT b = bit_value_to_count == 0 ? UT{0} : kLeftMost;
+
+    auto v = static_cast<UT>(e);
+    auto count = UT{0};
+    while ((count < kNumBits) && ((v & kLeftMost) == b)) {
+        ++count;
+        v <<= 1;
+    }
+    return count;
+}
+
 /// ImplConstant inherits from sem::Constant to add an private implementation method for conversion.
 struct ImplConstant : public sem::Constant {
     /// Convert attempts to convert the constant value to the given type. On error, Convert()
@@ -1639,17 +1656,7 @@
         auto create = [&](auto e) {
             using NumberT = decltype(e);
             using T = UnwrapNumber<NumberT>;
-            using UT = std::make_unsigned_t<T>;
-            constexpr UT kNumBits = sizeof(UT) * 8;
-            constexpr UT kLeftMost = UT{1} << (kNumBits - 1);
-
-            auto v = static_cast<UT>(e);
-            auto count = UT{0};
-            while ((count < kNumBits) && ((v & kLeftMost) == 0)) {
-                ++count;
-                v <<= 1;
-            }
-
+            auto count = CountLeadingBits(T{e}, T{0});
             return CreateElement(builder, c0->Type(), NumberT(count));
         };
         return Dispatch_iu32(create, c0);
@@ -1706,6 +1713,50 @@
     return TransformElements(builder, ty, transform, args[0]);
 }
 
+ConstEval::Result ConstEval::firstLeadingBit(const sem::Type* ty,
+                                             utils::VectorRef<const sem::Constant*> args,
+                                             const Source&) {
+    auto transform = [&](const sem::Constant* c0) {
+        auto create = [&](auto e) {
+            using NumberT = decltype(e);
+            using T = UnwrapNumber<NumberT>;
+            using UT = std::make_unsigned_t<T>;
+            constexpr UT kNumBits = sizeof(UT) * 8;
+
+            NumberT result;
+            if constexpr (IsUnsignedIntegral<T>) {
+                if (e == T{0}) {
+                    // T(-1) if e is zero.
+                    result = NumberT(static_cast<T>(-1));
+                } else {
+                    // Otherwise the position of the most significant 1 bit in e.
+                    static_assert(std::is_same_v<T, UT>);
+                    UT count = CountLeadingBits(UT{e}, UT{0});
+                    UT pos = kNumBits - count - 1;
+                    result = NumberT(pos);
+                }
+            } else {
+                if (e == T{0} || e == T{-1}) {
+                    // -1 if e is 0 or -1.
+                    result = NumberT(-1);
+                } else {
+                    // Otherwise the position of the most significant bit in e that is different
+                    // from e's sign bit.
+                    UT eu = static_cast<UT>(e);
+                    UT sign_bit = eu >> (kNumBits - 1);
+                    UT count = CountLeadingBits(eu, sign_bit);
+                    UT pos = kNumBits - count - 1;
+                    result = NumberT(pos);
+                }
+            }
+
+            return CreateElement(builder, c0->Type(), result);
+        };
+        return Dispatch_iu32(create, c0);
+    };
+    return TransformElements(builder, ty, transform, args[0]);
+}
+
 ConstEval::Result ConstEval::saturate(const sem::Type* ty,
                                       utils::VectorRef<const sem::Constant*> args,
                                       const Source&) {
diff --git a/src/tint/resolver/const_eval.h b/src/tint/resolver/const_eval.h
index 4e701f9..3474bcc 100644
--- a/src/tint/resolver/const_eval.h
+++ b/src/tint/resolver/const_eval.h
@@ -467,6 +467,15 @@
                               utils::VectorRef<const sem::Constant*> args,
                               const Source& source);
 
+    /// firstLeadingBit 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 firstLeadingBit(const sem::Type* ty,
+                           utils::VectorRef<const sem::Constant*> args,
+                           const Source& source);
+
     /// saturate 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 71ec92e..f831dcc 100644
--- a/src/tint/resolver/const_eval_builtin_test.cc
+++ b/src/tint/resolver/const_eval_builtin_test.cc
@@ -619,6 +619,68 @@
                                               CountOneBitsCases<u32>()))));
 
 template <typename T>
+std::vector<Case> FirstLeadingBitCases() {
+    using B = BitValues<T>;
+    auto r = std::vector<Case>{
+        // Both signed and unsigned return T(-1) for input 0
+        C({T(0)}, T(-1)),
+
+        C({B::Lsh(1, 30)}, T(30)),  //
+        C({B::Lsh(1, 29)}, T(29)),  //
+        C({B::Lsh(1, 28)}, T(28)),
+        //...
+        C({B::Lsh(1, 3)}, T(3)),  //
+        C({B::Lsh(1, 2)}, T(2)),  //
+        C({B::Lsh(1, 1)}, T(1)),  //
+        C({B::Lsh(1, 0)}, T(0)),
+
+        C({T(0b0000'0000'0100'1000'1000'1000'0000'0000)}, T(22)),
+        C({T(0b0000'0000'0000'0100'1000'1000'0000'0000)}, T(18)),
+
+        // Vector tests
+        C({Vec(B::Lsh(1, 30), B::Lsh(1, 29), B::Lsh(1, 28))}, Vec(T(30), T(29), T(28))),
+        C({Vec(B::Lsh(1, 2), B::Lsh(1, 1), B::Lsh(1, 0))}, Vec(T(2), T(1), T(0))),
+    };
+
+    ConcatIntoIf<IsUnsignedIntegral<T>>(  //
+        r, std::vector<Case>{
+               C({B::Lsh(1, 31)}, T(31)),
+
+               C({T(0b1111'1111'1111'1111'1111'1111'1111'1110)}, T(31)),
+               C({T(0b1111'1111'1111'1111'1111'1111'1111'1100)}, T(31)),
+               C({T(0b1111'1111'1111'1111'1111'1111'1111'1000)}, T(31)),
+               //...
+               C({T(0b1110'0000'0000'0000'0000'0000'0000'0000)}, T(31)),
+               C({T(0b1100'0000'0000'0000'0000'0000'0000'0000)}, T(31)),
+               C({T(0b1000'0000'0000'0000'0000'0000'0000'0000)}, T(31)),
+           });
+
+    ConcatIntoIf<IsSignedIntegral<T>>(  //
+        r, std::vector<Case>{
+               // Signed returns -1 for input -1
+               C({T(-1)}, T(-1)),
+
+               C({B::Lsh(1, 31)}, T(30)),
+
+               C({T(0b1111'1111'1111'1111'1111'1111'1111'1110)}, T(0)),
+               C({T(0b1111'1111'1111'1111'1111'1111'1111'1100)}, T(1)),
+               C({T(0b1111'1111'1111'1111'1111'1111'1111'1000)}, T(2)),
+               //...
+               C({T(0b1110'0000'0000'0000'0000'0000'0000'0000)}, T(28)),
+               C({T(0b1100'0000'0000'0000'0000'0000'0000'0000)}, T(29)),
+               C({T(0b1000'0000'0000'0000'0000'0000'0000'0000)}, T(30)),
+           });
+
+    return r;
+}
+INSTANTIATE_TEST_SUITE_P(  //
+    FirstLeadingBit,
+    ResolverConstEvalBuiltinTest,
+    testing::Combine(testing::Values(sem::BuiltinType::kFirstLeadingBit),
+                     testing::ValuesIn(Concat(FirstLeadingBitCases<i32>(),  //
+                                              FirstLeadingBitCases<u32>()))));
+
+template <typename T>
 std::vector<Case> SaturateCases() {
     return {
         C({T(0)}, T(0)),
diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl
index ae0ea8a..265bf04 100644
--- a/src/tint/resolver/intrinsic_table.inl
+++ b/src/tint/resolver/intrinsic_table.inl
@@ -12196,7 +12196,7 @@
     /* parameters */ &kParameters[910],
     /* return matcher indices */ &kMatcherIndices[1],
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
-    /* const eval */ nullptr,
+    /* const eval */ &ConstEval::firstLeadingBit,
   },
   {
     /* [323] */
@@ -12208,7 +12208,7 @@
     /* parameters */ &kParameters[909],
     /* return matcher indices */ &kMatcherIndices[30],
     /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
-    /* const eval */ nullptr,
+    /* const eval */ &ConstEval::firstLeadingBit,
   },
   {
     /* [324] */
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.dxc.hlsl
index c2dceab..45ae76f 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.dxc.hlsl
@@ -1,20 +1,5 @@
-uint4 tint_first_leading_bit(uint4 v) {
-  uint4 x = v;
-  const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx);
-  x = (x >> b16);
-  const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx);
-  x = (x >> b8);
-  const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx);
-  x = (x >> b4);
-  const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx);
-  x = (x >> b2);
-  const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx);
-  const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx);
-  return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_000ff3() {
-  uint4 res = tint_first_leading_bit((1u).xxxx);
+  uint4 res = (0u).xxxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.fxc.hlsl
index c2dceab..45ae76f 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.fxc.hlsl
@@ -1,20 +1,5 @@
-uint4 tint_first_leading_bit(uint4 v) {
-  uint4 x = v;
-  const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx);
-  x = (x >> b16);
-  const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx);
-  x = (x >> b8);
-  const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx);
-  x = (x >> b4);
-  const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx);
-  x = (x >> b2);
-  const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx);
-  const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx);
-  return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_000ff3() {
-  uint4 res = tint_first_leading_bit((1u).xxxx);
+  uint4 res = (0u).xxxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.glsl
index 6ba5463..01903b7 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.glsl
@@ -1,22 +1,7 @@
 #version 310 es
 
-uvec4 tint_first_leading_bit(uvec4 v) {
-  uvec4 x = v;
-  uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
-  x = (x >> b16);
-  uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
-  x = (x >> b8);
-  uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
-  x = (x >> b4);
-  uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
-  x = (x >> b2);
-  uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
-  uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
-  return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_000ff3() {
-  uvec4 res = tint_first_leading_bit(uvec4(1u));
+  uvec4 res = uvec4(0u);
 }
 
 vec4 vertex_main() {
@@ -35,23 +20,8 @@
 #version 310 es
 precision mediump float;
 
-uvec4 tint_first_leading_bit(uvec4 v) {
-  uvec4 x = v;
-  uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
-  x = (x >> b16);
-  uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
-  x = (x >> b8);
-  uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
-  x = (x >> b4);
-  uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
-  x = (x >> b2);
-  uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
-  uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
-  return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_000ff3() {
-  uvec4 res = tint_first_leading_bit(uvec4(1u));
+  uvec4 res = uvec4(0u);
 }
 
 void fragment_main() {
@@ -64,23 +34,8 @@
 }
 #version 310 es
 
-uvec4 tint_first_leading_bit(uvec4 v) {
-  uvec4 x = v;
-  uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
-  x = (x >> b16);
-  uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
-  x = (x >> b8);
-  uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
-  x = (x >> b4);
-  uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
-  x = (x >> b2);
-  uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
-  uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
-  return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_000ff3() {
-  uvec4 res = tint_first_leading_bit(uvec4(1u));
+  uvec4 res = uvec4(0u);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.msl
index 45a5d2b..0fbd78d 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.msl
@@ -1,23 +1,8 @@
 #include <metal_stdlib>
 
 using namespace metal;
-uint4 tint_first_leading_bit(uint4 v) {
-  uint4 x = v;
-  uint4 const b16 = select(uint4(0u), uint4(16u), bool4((x & uint4(4294901760u))));
-  x = (x >> b16);
-  uint4 const b8 = select(uint4(0u), uint4(8u), bool4((x & uint4(65280u))));
-  x = (x >> b8);
-  uint4 const b4 = select(uint4(0u), uint4(4u), bool4((x & uint4(240u))));
-  x = (x >> b4);
-  uint4 const b2 = select(uint4(0u), uint4(2u), bool4((x & uint4(12u))));
-  x = (x >> b2);
-  uint4 const b1 = select(uint4(0u), uint4(1u), bool4((x & uint4(2u))));
-  uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u)));
-  return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_000ff3() {
-  uint4 res = tint_first_leading_bit(uint4(1u));
+  uint4 res = uint4(0u);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.spvasm
index 8b00728..6a77c3f 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/000ff3.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 97
+; Bound: 32
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -12,9 +12,6 @@
                OpExecutionMode %compute_main LocalSize 1 1 1
                OpName %value "value"
                OpName %vertex_point_size "vertex_point_size"
-               OpName %tint_first_leading_bit "tint_first_leading_bit"
-               OpName %v "v"
-               OpName %x "x"
                OpName %firstLeadingBit_000ff3 "firstLeadingBit_000ff3"
                OpName %res "res"
                OpName %vertex_main_inner "vertex_main_inner"
@@ -31,110 +28,39 @@
 %_ptr_Output_float = OpTypePointer Output %float
           %8 = OpConstantNull %float
 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
        %uint = OpTypeInt 32 0
      %v4uint = OpTypeVector %uint 4
-          %9 = OpTypeFunction %v4uint %v4uint
+         %15 = OpConstantNull %v4uint
 %_ptr_Function_v4uint = OpTypePointer Function %v4uint
-         %17 = OpConstantNull %v4uint
-       %bool = OpTypeBool
-     %v4bool = OpTypeVector %bool 4
-%uint_4294901760 = OpConstant %uint 4294901760
-         %24 = OpConstantComposite %v4uint %uint_4294901760 %uint_4294901760 %uint_4294901760 %uint_4294901760
-    %uint_16 = OpConstant %uint 16
-         %27 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16
- %uint_65280 = OpConstant %uint 65280
-         %34 = OpConstantComposite %v4uint %uint_65280 %uint_65280 %uint_65280 %uint_65280
-     %uint_8 = OpConstant %uint 8
-         %37 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8
-   %uint_240 = OpConstant %uint 240
-         %44 = OpConstantComposite %v4uint %uint_240 %uint_240 %uint_240 %uint_240
-     %uint_4 = OpConstant %uint 4
-         %47 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4
-    %uint_12 = OpConstant %uint 12
-         %54 = OpConstantComposite %v4uint %uint_12 %uint_12 %uint_12 %uint_12
-     %uint_2 = OpConstant %uint 2
-         %57 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2
-     %uint_1 = OpConstant %uint 1
-         %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
-%uint_4294967295 = OpConstant %uint 4294967295
-         %70 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295
-       %void = OpTypeVoid
-         %77 = OpTypeFunction %void
-         %83 = OpTypeFunction %v4float
+         %18 = OpTypeFunction %v4float
     %float_1 = OpConstant %float 1
-%tint_first_leading_bit = OpFunction %v4uint None %9
-          %v = OpFunctionParameter %v4uint
-         %14 = OpLabel
-          %x = OpVariable %_ptr_Function_v4uint Function %17
-               OpStore %x %v
-         %22 = OpLoad %v4uint %x
-         %25 = OpBitwiseAnd %v4uint %22 %24
-         %19 = OpINotEqual %v4bool %25 %17
-         %18 = OpSelect %v4uint %19 %27 %17
-         %28 = OpLoad %v4uint %x
-         %29 = OpShiftRightLogical %v4uint %28 %18
-               OpStore %x %29
-         %32 = OpLoad %v4uint %x
-         %35 = OpBitwiseAnd %v4uint %32 %34
-         %31 = OpINotEqual %v4bool %35 %17
-         %30 = OpSelect %v4uint %31 %37 %17
-         %38 = OpLoad %v4uint %x
-         %39 = OpShiftRightLogical %v4uint %38 %30
-               OpStore %x %39
-         %42 = OpLoad %v4uint %x
-         %45 = OpBitwiseAnd %v4uint %42 %44
-         %41 = OpINotEqual %v4bool %45 %17
-         %40 = OpSelect %v4uint %41 %47 %17
-         %48 = OpLoad %v4uint %x
-         %49 = OpShiftRightLogical %v4uint %48 %40
-               OpStore %x %49
-         %52 = OpLoad %v4uint %x
-         %55 = OpBitwiseAnd %v4uint %52 %54
-         %51 = OpINotEqual %v4bool %55 %17
-         %50 = OpSelect %v4uint %51 %57 %17
-         %58 = OpLoad %v4uint %x
-         %59 = OpShiftRightLogical %v4uint %58 %50
-               OpStore %x %59
-         %62 = OpLoad %v4uint %x
-         %63 = OpBitwiseAnd %v4uint %62 %57
-         %61 = OpINotEqual %v4bool %63 %17
-         %60 = OpSelect %v4uint %61 %65 %17
-         %67 = OpLoad %v4uint %x
-         %68 = OpIEqual %v4bool %67 %17
-         %66 = OpSelect %v4uint %68 %70 %17
-         %72 = OpBitwiseOr %v4uint %18 %30
-         %73 = OpBitwiseOr %v4uint %72 %40
-         %74 = OpBitwiseOr %v4uint %73 %50
-         %75 = OpBitwiseOr %v4uint %74 %60
-         %76 = OpBitwiseOr %v4uint %75 %66
-               OpReturnValue %76
-               OpFunctionEnd
-%firstLeadingBit_000ff3 = OpFunction %void None %77
-         %80 = OpLabel
-        %res = OpVariable %_ptr_Function_v4uint Function %17
-         %81 = OpFunctionCall %v4uint %tint_first_leading_bit %65
-               OpStore %res %81
+%firstLeadingBit_000ff3 = OpFunction %void None %9
+         %12 = OpLabel
+        %res = OpVariable %_ptr_Function_v4uint Function %15
+               OpStore %res %15
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %83
-         %85 = OpLabel
-         %86 = OpFunctionCall %void %firstLeadingBit_000ff3
+%vertex_main_inner = OpFunction %v4float None %18
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %firstLeadingBit_000ff3
                OpReturnValue %5
                OpFunctionEnd
-%vertex_main = OpFunction %void None %77
-         %88 = OpLabel
-         %89 = OpFunctionCall %v4float %vertex_main_inner
-               OpStore %value %89
+%vertex_main = OpFunction %void None %9
+         %23 = OpLabel
+         %24 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %24
                OpStore %vertex_point_size %float_1
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %77
-         %92 = OpLabel
-         %93 = OpFunctionCall %void %firstLeadingBit_000ff3
+%fragment_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %firstLeadingBit_000ff3
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %77
-         %95 = OpLabel
-         %96 = OpFunctionCall %void %firstLeadingBit_000ff3
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %firstLeadingBit_000ff3
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.dxc.hlsl
index 24d1789..64de243 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.dxc.hlsl
@@ -1,20 +1,5 @@
-int3 tint_first_leading_bit(int3 v) {
-  uint3 x = ((v < (0).xxx) ? uint3(~(v)) : uint3(v));
-  const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx);
-  x = (x >> b16);
-  const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx);
-  x = (x >> b8);
-  const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx);
-  x = (x >> b4);
-  const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx);
-  x = (x >> b2);
-  const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx);
-  const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx);
-  return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_35053e() {
-  int3 res = tint_first_leading_bit((1).xxx);
+  int3 res = (0).xxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.fxc.hlsl
index 24d1789..64de243 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.fxc.hlsl
@@ -1,20 +1,5 @@
-int3 tint_first_leading_bit(int3 v) {
-  uint3 x = ((v < (0).xxx) ? uint3(~(v)) : uint3(v));
-  const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx);
-  x = (x >> b16);
-  const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx);
-  x = (x >> b8);
-  const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx);
-  x = (x >> b4);
-  const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx);
-  x = (x >> b2);
-  const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx);
-  const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx);
-  return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_35053e() {
-  int3 res = tint_first_leading_bit((1).xxx);
+  int3 res = (0).xxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.glsl
index d5eaa27..9f61ef1 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.glsl
@@ -1,22 +1,7 @@
 #version 310 es
 
-ivec3 tint_first_leading_bit(ivec3 v) {
-  uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0)));
-  uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
-  x = (x >> b16);
-  uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
-  x = (x >> b8);
-  uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
-  x = (x >> b4);
-  uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
-  x = (x >> b2);
-  uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
-  uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
-  return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_35053e() {
-  ivec3 res = tint_first_leading_bit(ivec3(1));
+  ivec3 res = ivec3(0);
 }
 
 vec4 vertex_main() {
@@ -35,23 +20,8 @@
 #version 310 es
 precision mediump float;
 
-ivec3 tint_first_leading_bit(ivec3 v) {
-  uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0)));
-  uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
-  x = (x >> b16);
-  uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
-  x = (x >> b8);
-  uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
-  x = (x >> b4);
-  uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
-  x = (x >> b2);
-  uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
-  uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
-  return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_35053e() {
-  ivec3 res = tint_first_leading_bit(ivec3(1));
+  ivec3 res = ivec3(0);
 }
 
 void fragment_main() {
@@ -64,23 +34,8 @@
 }
 #version 310 es
 
-ivec3 tint_first_leading_bit(ivec3 v) {
-  uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0)));
-  uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
-  x = (x >> b16);
-  uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
-  x = (x >> b8);
-  uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
-  x = (x >> b4);
-  uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
-  x = (x >> b2);
-  uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
-  uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
-  return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_35053e() {
-  ivec3 res = tint_first_leading_bit(ivec3(1));
+  ivec3 res = ivec3(0);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.msl
index ffaef38..251f337 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.msl
@@ -1,23 +1,8 @@
 #include <metal_stdlib>
 
 using namespace metal;
-int3 tint_first_leading_bit(int3 v) {
-  uint3 x = select(uint3(v), uint3(~(v)), (v < int3(0)));
-  uint3 const b16 = select(uint3(0u), uint3(16u), bool3((x & uint3(4294901760u))));
-  x = (x >> b16);
-  uint3 const b8 = select(uint3(0u), uint3(8u), bool3((x & uint3(65280u))));
-  x = (x >> b8);
-  uint3 const b4 = select(uint3(0u), uint3(4u), bool3((x & uint3(240u))));
-  x = (x >> b4);
-  uint3 const b2 = select(uint3(0u), uint3(2u), bool3((x & uint3(12u))));
-  x = (x >> b2);
-  uint3 const b1 = select(uint3(0u), uint3(1u), bool3((x & uint3(2u))));
-  uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u)));
-  return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_35053e() {
-  int3 res = tint_first_leading_bit(int3(1));
+  int3 res = int3(0);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.spvasm
index 3fc5bef..a026344 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/35053e.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 108
+; Bound: 32
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -12,9 +12,6 @@
                OpExecutionMode %compute_main LocalSize 1 1 1
                OpName %value "value"
                OpName %vertex_point_size "vertex_point_size"
-               OpName %tint_first_leading_bit "tint_first_leading_bit"
-               OpName %v "v"
-               OpName %x "x"
                OpName %firstLeadingBit_35053e "firstLeadingBit_35053e"
                OpName %res "res"
                OpName %vertex_main_inner "vertex_main_inner"
@@ -31,122 +28,39 @@
 %_ptr_Output_float = OpTypePointer Output %float
           %8 = OpConstantNull %float
 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
         %int = OpTypeInt 32 1
       %v3int = OpTypeVector %int 3
-          %9 = OpTypeFunction %v3int %v3int
-       %uint = OpTypeInt 32 0
-     %v3uint = OpTypeVector %uint 3
-         %18 = OpConstantNull %v3int
-       %bool = OpTypeBool
-     %v3bool = OpTypeVector %bool 3
-%_ptr_Function_v3uint = OpTypePointer Function %v3uint
-         %27 = OpConstantNull %v3uint
-%uint_4294901760 = OpConstant %uint 4294901760
-         %32 = OpConstantComposite %v3uint %uint_4294901760 %uint_4294901760 %uint_4294901760
-    %uint_16 = OpConstant %uint 16
-         %35 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16
- %uint_65280 = OpConstant %uint 65280
-         %42 = OpConstantComposite %v3uint %uint_65280 %uint_65280 %uint_65280
-     %uint_8 = OpConstant %uint 8
-         %45 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8
-   %uint_240 = OpConstant %uint 240
-         %52 = OpConstantComposite %v3uint %uint_240 %uint_240 %uint_240
-     %uint_4 = OpConstant %uint 4
-         %55 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4
-    %uint_12 = OpConstant %uint 12
-         %62 = OpConstantComposite %v3uint %uint_12 %uint_12 %uint_12
-     %uint_2 = OpConstant %uint 2
-         %65 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2
-     %uint_1 = OpConstant %uint 1
-         %73 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
-%uint_4294967295 = OpConstant %uint 4294967295
-         %78 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295
-       %void = OpTypeVoid
-         %85 = OpTypeFunction %void
-      %int_1 = OpConstant %int 1
-         %91 = OpConstantComposite %v3int %int_1 %int_1 %int_1
+         %15 = OpConstantNull %v3int
 %_ptr_Function_v3int = OpTypePointer Function %v3int
-         %94 = OpTypeFunction %v4float
+         %18 = OpTypeFunction %v4float
     %float_1 = OpConstant %float 1
-%tint_first_leading_bit = OpFunction %v3int None %9
-          %v = OpFunctionParameter %v3int
-         %14 = OpLabel
-          %x = OpVariable %_ptr_Function_v3uint Function %27
-         %19 = OpSLessThan %v3bool %v %18
-         %23 = OpNot %v3int %v
-         %22 = OpBitcast %v3uint %23
-         %24 = OpBitcast %v3uint %v
-         %15 = OpSelect %v3uint %19 %22 %24
-               OpStore %x %15
-         %30 = OpLoad %v3uint %x
-         %33 = OpBitwiseAnd %v3uint %30 %32
-         %29 = OpINotEqual %v3bool %33 %27
-         %28 = OpSelect %v3uint %29 %35 %27
-         %36 = OpLoad %v3uint %x
-         %37 = OpShiftRightLogical %v3uint %36 %28
-               OpStore %x %37
-         %40 = OpLoad %v3uint %x
-         %43 = OpBitwiseAnd %v3uint %40 %42
-         %39 = OpINotEqual %v3bool %43 %27
-         %38 = OpSelect %v3uint %39 %45 %27
-         %46 = OpLoad %v3uint %x
-         %47 = OpShiftRightLogical %v3uint %46 %38
-               OpStore %x %47
-         %50 = OpLoad %v3uint %x
-         %53 = OpBitwiseAnd %v3uint %50 %52
-         %49 = OpINotEqual %v3bool %53 %27
-         %48 = OpSelect %v3uint %49 %55 %27
-         %56 = OpLoad %v3uint %x
-         %57 = OpShiftRightLogical %v3uint %56 %48
-               OpStore %x %57
-         %60 = OpLoad %v3uint %x
-         %63 = OpBitwiseAnd %v3uint %60 %62
-         %59 = OpINotEqual %v3bool %63 %27
-         %58 = OpSelect %v3uint %59 %65 %27
-         %66 = OpLoad %v3uint %x
-         %67 = OpShiftRightLogical %v3uint %66 %58
-               OpStore %x %67
-         %70 = OpLoad %v3uint %x
-         %71 = OpBitwiseAnd %v3uint %70 %65
-         %69 = OpINotEqual %v3bool %71 %27
-         %68 = OpSelect %v3uint %69 %73 %27
-         %75 = OpLoad %v3uint %x
-         %76 = OpIEqual %v3bool %75 %27
-         %74 = OpSelect %v3uint %76 %78 %27
-         %80 = OpBitwiseOr %v3uint %28 %38
-         %81 = OpBitwiseOr %v3uint %80 %48
-         %82 = OpBitwiseOr %v3uint %81 %58
-         %83 = OpBitwiseOr %v3uint %82 %68
-         %84 = OpBitwiseOr %v3uint %83 %74
-         %79 = OpBitcast %v3int %84
-               OpReturnValue %79
-               OpFunctionEnd
-%firstLeadingBit_35053e = OpFunction %void None %85
-         %88 = OpLabel
-        %res = OpVariable %_ptr_Function_v3int Function %18
-         %89 = OpFunctionCall %v3int %tint_first_leading_bit %91
-               OpStore %res %89
+%firstLeadingBit_35053e = OpFunction %void None %9
+         %12 = OpLabel
+        %res = OpVariable %_ptr_Function_v3int Function %15
+               OpStore %res %15
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %94
-         %96 = OpLabel
-         %97 = OpFunctionCall %void %firstLeadingBit_35053e
+%vertex_main_inner = OpFunction %v4float None %18
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %firstLeadingBit_35053e
                OpReturnValue %5
                OpFunctionEnd
-%vertex_main = OpFunction %void None %85
-         %99 = OpLabel
-        %100 = OpFunctionCall %v4float %vertex_main_inner
-               OpStore %value %100
+%vertex_main = OpFunction %void None %9
+         %23 = OpLabel
+         %24 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %24
                OpStore %vertex_point_size %float_1
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %85
-        %103 = OpLabel
-        %104 = OpFunctionCall %void %firstLeadingBit_35053e
+%fragment_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %firstLeadingBit_35053e
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %85
-        %106 = OpLabel
-        %107 = OpFunctionCall %void %firstLeadingBit_35053e
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %firstLeadingBit_35053e
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.dxc.hlsl
index 9da9693..453df54 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.dxc.hlsl
@@ -1,20 +1,5 @@
-uint3 tint_first_leading_bit(uint3 v) {
-  uint3 x = v;
-  const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx);
-  x = (x >> b16);
-  const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx);
-  x = (x >> b8);
-  const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx);
-  x = (x >> b4);
-  const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx);
-  x = (x >> b2);
-  const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx);
-  const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx);
-  return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_3fd7d0() {
-  uint3 res = tint_first_leading_bit((1u).xxx);
+  uint3 res = (0u).xxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.fxc.hlsl
index 9da9693..453df54 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.fxc.hlsl
@@ -1,20 +1,5 @@
-uint3 tint_first_leading_bit(uint3 v) {
-  uint3 x = v;
-  const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx);
-  x = (x >> b16);
-  const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx);
-  x = (x >> b8);
-  const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx);
-  x = (x >> b4);
-  const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx);
-  x = (x >> b2);
-  const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx);
-  const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx);
-  return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_3fd7d0() {
-  uint3 res = tint_first_leading_bit((1u).xxx);
+  uint3 res = (0u).xxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.glsl
index 0924cb1..943e83a 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.glsl
@@ -1,22 +1,7 @@
 #version 310 es
 
-uvec3 tint_first_leading_bit(uvec3 v) {
-  uvec3 x = v;
-  uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
-  x = (x >> b16);
-  uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
-  x = (x >> b8);
-  uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
-  x = (x >> b4);
-  uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
-  x = (x >> b2);
-  uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
-  uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
-  return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_3fd7d0() {
-  uvec3 res = tint_first_leading_bit(uvec3(1u));
+  uvec3 res = uvec3(0u);
 }
 
 vec4 vertex_main() {
@@ -35,23 +20,8 @@
 #version 310 es
 precision mediump float;
 
-uvec3 tint_first_leading_bit(uvec3 v) {
-  uvec3 x = v;
-  uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
-  x = (x >> b16);
-  uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
-  x = (x >> b8);
-  uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
-  x = (x >> b4);
-  uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
-  x = (x >> b2);
-  uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
-  uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
-  return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_3fd7d0() {
-  uvec3 res = tint_first_leading_bit(uvec3(1u));
+  uvec3 res = uvec3(0u);
 }
 
 void fragment_main() {
@@ -64,23 +34,8 @@
 }
 #version 310 es
 
-uvec3 tint_first_leading_bit(uvec3 v) {
-  uvec3 x = v;
-  uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
-  x = (x >> b16);
-  uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
-  x = (x >> b8);
-  uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
-  x = (x >> b4);
-  uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
-  x = (x >> b2);
-  uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
-  uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
-  return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_3fd7d0() {
-  uvec3 res = tint_first_leading_bit(uvec3(1u));
+  uvec3 res = uvec3(0u);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.msl
index 9ed14ec..6204d0d 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.msl
@@ -1,23 +1,8 @@
 #include <metal_stdlib>
 
 using namespace metal;
-uint3 tint_first_leading_bit(uint3 v) {
-  uint3 x = v;
-  uint3 const b16 = select(uint3(0u), uint3(16u), bool3((x & uint3(4294901760u))));
-  x = (x >> b16);
-  uint3 const b8 = select(uint3(0u), uint3(8u), bool3((x & uint3(65280u))));
-  x = (x >> b8);
-  uint3 const b4 = select(uint3(0u), uint3(4u), bool3((x & uint3(240u))));
-  x = (x >> b4);
-  uint3 const b2 = select(uint3(0u), uint3(2u), bool3((x & uint3(12u))));
-  x = (x >> b2);
-  uint3 const b1 = select(uint3(0u), uint3(1u), bool3((x & uint3(2u))));
-  uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u)));
-  return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_3fd7d0() {
-  uint3 res = tint_first_leading_bit(uint3(1u));
+  uint3 res = uint3(0u);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.spvasm
index 651285f..6960601 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/3fd7d0.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 97
+; Bound: 32
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -12,9 +12,6 @@
                OpExecutionMode %compute_main LocalSize 1 1 1
                OpName %value "value"
                OpName %vertex_point_size "vertex_point_size"
-               OpName %tint_first_leading_bit "tint_first_leading_bit"
-               OpName %v "v"
-               OpName %x "x"
                OpName %firstLeadingBit_3fd7d0 "firstLeadingBit_3fd7d0"
                OpName %res "res"
                OpName %vertex_main_inner "vertex_main_inner"
@@ -31,110 +28,39 @@
 %_ptr_Output_float = OpTypePointer Output %float
           %8 = OpConstantNull %float
 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
        %uint = OpTypeInt 32 0
      %v3uint = OpTypeVector %uint 3
-          %9 = OpTypeFunction %v3uint %v3uint
+         %15 = OpConstantNull %v3uint
 %_ptr_Function_v3uint = OpTypePointer Function %v3uint
-         %17 = OpConstantNull %v3uint
-       %bool = OpTypeBool
-     %v3bool = OpTypeVector %bool 3
-%uint_4294901760 = OpConstant %uint 4294901760
-         %24 = OpConstantComposite %v3uint %uint_4294901760 %uint_4294901760 %uint_4294901760
-    %uint_16 = OpConstant %uint 16
-         %27 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16
- %uint_65280 = OpConstant %uint 65280
-         %34 = OpConstantComposite %v3uint %uint_65280 %uint_65280 %uint_65280
-     %uint_8 = OpConstant %uint 8
-         %37 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8
-   %uint_240 = OpConstant %uint 240
-         %44 = OpConstantComposite %v3uint %uint_240 %uint_240 %uint_240
-     %uint_4 = OpConstant %uint 4
-         %47 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4
-    %uint_12 = OpConstant %uint 12
-         %54 = OpConstantComposite %v3uint %uint_12 %uint_12 %uint_12
-     %uint_2 = OpConstant %uint 2
-         %57 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2
-     %uint_1 = OpConstant %uint 1
-         %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
-%uint_4294967295 = OpConstant %uint 4294967295
-         %70 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295
-       %void = OpTypeVoid
-         %77 = OpTypeFunction %void
-         %83 = OpTypeFunction %v4float
+         %18 = OpTypeFunction %v4float
     %float_1 = OpConstant %float 1
-%tint_first_leading_bit = OpFunction %v3uint None %9
-          %v = OpFunctionParameter %v3uint
-         %14 = OpLabel
-          %x = OpVariable %_ptr_Function_v3uint Function %17
-               OpStore %x %v
-         %22 = OpLoad %v3uint %x
-         %25 = OpBitwiseAnd %v3uint %22 %24
-         %19 = OpINotEqual %v3bool %25 %17
-         %18 = OpSelect %v3uint %19 %27 %17
-         %28 = OpLoad %v3uint %x
-         %29 = OpShiftRightLogical %v3uint %28 %18
-               OpStore %x %29
-         %32 = OpLoad %v3uint %x
-         %35 = OpBitwiseAnd %v3uint %32 %34
-         %31 = OpINotEqual %v3bool %35 %17
-         %30 = OpSelect %v3uint %31 %37 %17
-         %38 = OpLoad %v3uint %x
-         %39 = OpShiftRightLogical %v3uint %38 %30
-               OpStore %x %39
-         %42 = OpLoad %v3uint %x
-         %45 = OpBitwiseAnd %v3uint %42 %44
-         %41 = OpINotEqual %v3bool %45 %17
-         %40 = OpSelect %v3uint %41 %47 %17
-         %48 = OpLoad %v3uint %x
-         %49 = OpShiftRightLogical %v3uint %48 %40
-               OpStore %x %49
-         %52 = OpLoad %v3uint %x
-         %55 = OpBitwiseAnd %v3uint %52 %54
-         %51 = OpINotEqual %v3bool %55 %17
-         %50 = OpSelect %v3uint %51 %57 %17
-         %58 = OpLoad %v3uint %x
-         %59 = OpShiftRightLogical %v3uint %58 %50
-               OpStore %x %59
-         %62 = OpLoad %v3uint %x
-         %63 = OpBitwiseAnd %v3uint %62 %57
-         %61 = OpINotEqual %v3bool %63 %17
-         %60 = OpSelect %v3uint %61 %65 %17
-         %67 = OpLoad %v3uint %x
-         %68 = OpIEqual %v3bool %67 %17
-         %66 = OpSelect %v3uint %68 %70 %17
-         %72 = OpBitwiseOr %v3uint %18 %30
-         %73 = OpBitwiseOr %v3uint %72 %40
-         %74 = OpBitwiseOr %v3uint %73 %50
-         %75 = OpBitwiseOr %v3uint %74 %60
-         %76 = OpBitwiseOr %v3uint %75 %66
-               OpReturnValue %76
-               OpFunctionEnd
-%firstLeadingBit_3fd7d0 = OpFunction %void None %77
-         %80 = OpLabel
-        %res = OpVariable %_ptr_Function_v3uint Function %17
-         %81 = OpFunctionCall %v3uint %tint_first_leading_bit %65
-               OpStore %res %81
+%firstLeadingBit_3fd7d0 = OpFunction %void None %9
+         %12 = OpLabel
+        %res = OpVariable %_ptr_Function_v3uint Function %15
+               OpStore %res %15
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %83
-         %85 = OpLabel
-         %86 = OpFunctionCall %void %firstLeadingBit_3fd7d0
+%vertex_main_inner = OpFunction %v4float None %18
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %firstLeadingBit_3fd7d0
                OpReturnValue %5
                OpFunctionEnd
-%vertex_main = OpFunction %void None %77
-         %88 = OpLabel
-         %89 = OpFunctionCall %v4float %vertex_main_inner
-               OpStore %value %89
+%vertex_main = OpFunction %void None %9
+         %23 = OpLabel
+         %24 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %24
                OpStore %vertex_point_size %float_1
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %77
-         %92 = OpLabel
-         %93 = OpFunctionCall %void %firstLeadingBit_3fd7d0
+%fragment_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %firstLeadingBit_3fd7d0
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %77
-         %95 = OpLabel
-         %96 = OpFunctionCall %void %firstLeadingBit_3fd7d0
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %firstLeadingBit_3fd7d0
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.dxc.hlsl
index 01ee3e9..a7803d3 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.dxc.hlsl
@@ -1,20 +1,5 @@
-int tint_first_leading_bit(int v) {
-  uint x = ((v < 0) ? uint(~(v)) : uint(v));
-  const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
-  x = (x >> b16);
-  const uint b8 = (bool((x & 65280u)) ? 8u : 0u);
-  x = (x >> b8);
-  const uint b4 = (bool((x & 240u)) ? 4u : 0u);
-  x = (x >> b4);
-  const uint b2 = (bool((x & 12u)) ? 2u : 0u);
-  x = (x >> b2);
-  const uint b1 = (bool((x & 2u)) ? 1u : 0u);
-  const uint is_zero = ((x == 0u) ? 4294967295u : 0u);
-  return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_57a1a3() {
-  int res = tint_first_leading_bit(1);
+  int res = 0;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.fxc.hlsl
index 01ee3e9..a7803d3 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.fxc.hlsl
@@ -1,20 +1,5 @@
-int tint_first_leading_bit(int v) {
-  uint x = ((v < 0) ? uint(~(v)) : uint(v));
-  const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
-  x = (x >> b16);
-  const uint b8 = (bool((x & 65280u)) ? 8u : 0u);
-  x = (x >> b8);
-  const uint b4 = (bool((x & 240u)) ? 4u : 0u);
-  x = (x >> b4);
-  const uint b2 = (bool((x & 12u)) ? 2u : 0u);
-  x = (x >> b2);
-  const uint b1 = (bool((x & 2u)) ? 1u : 0u);
-  const uint is_zero = ((x == 0u) ? 4294967295u : 0u);
-  return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_57a1a3() {
-  int res = tint_first_leading_bit(1);
+  int res = 0;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.glsl
index 27ce842..f084324 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.glsl
@@ -1,22 +1,7 @@
 #version 310 es
 
-int tint_first_leading_bit(int v) {
-  uint x = ((v < 0) ? uint(~(v)) : uint(v));
-  uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
-  x = (x >> b16);
-  uint b8 = (bool((x & 65280u)) ? 8u : 0u);
-  x = (x >> b8);
-  uint b4 = (bool((x & 240u)) ? 4u : 0u);
-  x = (x >> b4);
-  uint b2 = (bool((x & 12u)) ? 2u : 0u);
-  x = (x >> b2);
-  uint b1 = (bool((x & 2u)) ? 1u : 0u);
-  uint is_zero = ((x == 0u) ? 4294967295u : 0u);
-  return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_57a1a3() {
-  int res = tint_first_leading_bit(1);
+  int res = 0;
 }
 
 vec4 vertex_main() {
@@ -35,23 +20,8 @@
 #version 310 es
 precision mediump float;
 
-int tint_first_leading_bit(int v) {
-  uint x = ((v < 0) ? uint(~(v)) : uint(v));
-  uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
-  x = (x >> b16);
-  uint b8 = (bool((x & 65280u)) ? 8u : 0u);
-  x = (x >> b8);
-  uint b4 = (bool((x & 240u)) ? 4u : 0u);
-  x = (x >> b4);
-  uint b2 = (bool((x & 12u)) ? 2u : 0u);
-  x = (x >> b2);
-  uint b1 = (bool((x & 2u)) ? 1u : 0u);
-  uint is_zero = ((x == 0u) ? 4294967295u : 0u);
-  return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_57a1a3() {
-  int res = tint_first_leading_bit(1);
+  int res = 0;
 }
 
 void fragment_main() {
@@ -64,23 +34,8 @@
 }
 #version 310 es
 
-int tint_first_leading_bit(int v) {
-  uint x = ((v < 0) ? uint(~(v)) : uint(v));
-  uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
-  x = (x >> b16);
-  uint b8 = (bool((x & 65280u)) ? 8u : 0u);
-  x = (x >> b8);
-  uint b4 = (bool((x & 240u)) ? 4u : 0u);
-  x = (x >> b4);
-  uint b2 = (bool((x & 12u)) ? 2u : 0u);
-  x = (x >> b2);
-  uint b1 = (bool((x & 2u)) ? 1u : 0u);
-  uint is_zero = ((x == 0u) ? 4294967295u : 0u);
-  return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_57a1a3() {
-  int res = tint_first_leading_bit(1);
+  int res = 0;
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.msl
index ec9b539..44ced56 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.msl
@@ -1,23 +1,8 @@
 #include <metal_stdlib>
 
 using namespace metal;
-int tint_first_leading_bit(int v) {
-  uint x = select(uint(v), uint(~(v)), (v < 0));
-  uint const b16 = select(0u, 16u, bool((x & 4294901760u)));
-  x = (x >> b16);
-  uint const b8 = select(0u, 8u, bool((x & 65280u)));
-  x = (x >> b8);
-  uint const b4 = select(0u, 4u, bool((x & 240u)));
-  x = (x >> b4);
-  uint const b2 = select(0u, 2u, bool((x & 12u)));
-  x = (x >> b2);
-  uint const b1 = select(0u, 1u, bool((x & 2u)));
-  uint const is_zero = select(0u, 4294967295u, (x == 0u));
-  return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_57a1a3() {
-  int res = tint_first_leading_bit(1);
+  int res = 0;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.spvasm
index fea9df7..544a0e5 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/57a1a3.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 94
+; Bound: 31
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -12,9 +12,6 @@
                OpExecutionMode %compute_main LocalSize 1 1 1
                OpName %value "value"
                OpName %vertex_point_size "vertex_point_size"
-               OpName %tint_first_leading_bit "tint_first_leading_bit"
-               OpName %v "v"
-               OpName %x "x"
                OpName %firstLeadingBit_57a1a3 "firstLeadingBit_57a1a3"
                OpName %res "res"
                OpName %vertex_main_inner "vertex_main_inner"
@@ -31,108 +28,38 @@
 %_ptr_Output_float = OpTypePointer Output %float
           %8 = OpConstantNull %float
 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
-        %int = OpTypeInt 32 1
-          %9 = OpTypeFunction %int %int
-       %uint = OpTypeInt 32 0
-         %16 = OpConstantNull %int
-       %bool = OpTypeBool
-%_ptr_Function_uint = OpTypePointer Function %uint
-         %24 = OpConstantNull %uint
-%uint_4294901760 = OpConstant %uint 4294901760
-    %uint_16 = OpConstant %uint 16
- %uint_65280 = OpConstant %uint 65280
-     %uint_8 = OpConstant %uint 8
-   %uint_240 = OpConstant %uint 240
-     %uint_4 = OpConstant %uint 4
-    %uint_12 = OpConstant %uint 12
-     %uint_2 = OpConstant %uint 2
-     %uint_1 = OpConstant %uint 1
-%uint_4294967295 = OpConstant %uint 4294967295
        %void = OpTypeVoid
-         %72 = OpTypeFunction %void
-      %int_1 = OpConstant %int 1
+          %9 = OpTypeFunction %void
+        %int = OpTypeInt 32 1
+         %14 = OpConstantNull %int
 %_ptr_Function_int = OpTypePointer Function %int
-         %80 = OpTypeFunction %v4float
+         %17 = OpTypeFunction %v4float
     %float_1 = OpConstant %float 1
-%tint_first_leading_bit = OpFunction %int None %9
-          %v = OpFunctionParameter %int
-         %13 = OpLabel
-          %x = OpVariable %_ptr_Function_uint Function %24
-         %17 = OpSLessThan %bool %v %16
-         %20 = OpNot %int %v
-         %19 = OpBitcast %uint %20
-         %21 = OpBitcast %uint %v
-         %14 = OpSelect %uint %17 %19 %21
-               OpStore %x %14
-         %27 = OpLoad %uint %x
-         %29 = OpBitwiseAnd %uint %27 %uint_4294901760
-         %26 = OpINotEqual %bool %29 %24
-         %25 = OpSelect %uint %26 %uint_16 %24
-         %31 = OpLoad %uint %x
-         %32 = OpShiftRightLogical %uint %31 %25
-               OpStore %x %32
-         %35 = OpLoad %uint %x
-         %37 = OpBitwiseAnd %uint %35 %uint_65280
-         %34 = OpINotEqual %bool %37 %24
-         %33 = OpSelect %uint %34 %uint_8 %24
-         %39 = OpLoad %uint %x
-         %40 = OpShiftRightLogical %uint %39 %33
-               OpStore %x %40
-         %43 = OpLoad %uint %x
-         %45 = OpBitwiseAnd %uint %43 %uint_240
-         %42 = OpINotEqual %bool %45 %24
-         %41 = OpSelect %uint %42 %uint_4 %24
-         %47 = OpLoad %uint %x
-         %48 = OpShiftRightLogical %uint %47 %41
-               OpStore %x %48
-         %51 = OpLoad %uint %x
-         %53 = OpBitwiseAnd %uint %51 %uint_12
-         %50 = OpINotEqual %bool %53 %24
-         %49 = OpSelect %uint %50 %uint_2 %24
-         %55 = OpLoad %uint %x
-         %56 = OpShiftRightLogical %uint %55 %49
-               OpStore %x %56
-         %59 = OpLoad %uint %x
-         %60 = OpBitwiseAnd %uint %59 %uint_2
-         %58 = OpINotEqual %bool %60 %24
-         %57 = OpSelect %uint %58 %uint_1 %24
-         %63 = OpLoad %uint %x
-         %64 = OpIEqual %bool %63 %24
-         %62 = OpSelect %uint %64 %uint_4294967295 %24
-         %67 = OpBitwiseOr %uint %25 %33
-         %68 = OpBitwiseOr %uint %67 %41
-         %69 = OpBitwiseOr %uint %68 %49
-         %70 = OpBitwiseOr %uint %69 %57
-         %71 = OpBitwiseOr %uint %70 %62
-         %66 = OpBitcast %int %71
-               OpReturnValue %66
-               OpFunctionEnd
-%firstLeadingBit_57a1a3 = OpFunction %void None %72
-         %75 = OpLabel
-        %res = OpVariable %_ptr_Function_int Function %16
-         %76 = OpFunctionCall %int %tint_first_leading_bit %int_1
-               OpStore %res %76
+%firstLeadingBit_57a1a3 = OpFunction %void None %9
+         %12 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %14
+               OpStore %res %14
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %80
-         %82 = OpLabel
-         %83 = OpFunctionCall %void %firstLeadingBit_57a1a3
+%vertex_main_inner = OpFunction %v4float None %17
+         %19 = OpLabel
+         %20 = OpFunctionCall %void %firstLeadingBit_57a1a3
                OpReturnValue %5
                OpFunctionEnd
-%vertex_main = OpFunction %void None %72
-         %85 = OpLabel
-         %86 = OpFunctionCall %v4float %vertex_main_inner
-               OpStore %value %86
+%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 %72
-         %89 = OpLabel
-         %90 = OpFunctionCall %void %firstLeadingBit_57a1a3
+%fragment_main = OpFunction %void None %9
+         %26 = OpLabel
+         %27 = OpFunctionCall %void %firstLeadingBit_57a1a3
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %72
-         %92 = OpLabel
-         %93 = OpFunctionCall %void %firstLeadingBit_57a1a3
+%compute_main = OpFunction %void None %9
+         %29 = OpLabel
+         %30 = OpFunctionCall %void %firstLeadingBit_57a1a3
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.dxc.hlsl
index fc68e76..4a95cac 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.dxc.hlsl
@@ -1,20 +1,5 @@
-uint2 tint_first_leading_bit(uint2 v) {
-  uint2 x = v;
-  const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx);
-  x = (x >> b16);
-  const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx);
-  x = (x >> b8);
-  const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx);
-  x = (x >> b4);
-  const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx);
-  x = (x >> b2);
-  const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx);
-  const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx);
-  return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_6fe804() {
-  uint2 res = tint_first_leading_bit((1u).xx);
+  uint2 res = (0u).xx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.fxc.hlsl
index fc68e76..4a95cac 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.fxc.hlsl
@@ -1,20 +1,5 @@
-uint2 tint_first_leading_bit(uint2 v) {
-  uint2 x = v;
-  const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx);
-  x = (x >> b16);
-  const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx);
-  x = (x >> b8);
-  const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx);
-  x = (x >> b4);
-  const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx);
-  x = (x >> b2);
-  const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx);
-  const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx);
-  return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_6fe804() {
-  uint2 res = tint_first_leading_bit((1u).xx);
+  uint2 res = (0u).xx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.glsl
index e5c3839..8f5360e 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.glsl
@@ -1,22 +1,7 @@
 #version 310 es
 
-uvec2 tint_first_leading_bit(uvec2 v) {
-  uvec2 x = v;
-  uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
-  x = (x >> b16);
-  uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
-  x = (x >> b8);
-  uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
-  x = (x >> b4);
-  uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
-  x = (x >> b2);
-  uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
-  uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
-  return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_6fe804() {
-  uvec2 res = tint_first_leading_bit(uvec2(1u));
+  uvec2 res = uvec2(0u);
 }
 
 vec4 vertex_main() {
@@ -35,23 +20,8 @@
 #version 310 es
 precision mediump float;
 
-uvec2 tint_first_leading_bit(uvec2 v) {
-  uvec2 x = v;
-  uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
-  x = (x >> b16);
-  uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
-  x = (x >> b8);
-  uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
-  x = (x >> b4);
-  uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
-  x = (x >> b2);
-  uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
-  uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
-  return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_6fe804() {
-  uvec2 res = tint_first_leading_bit(uvec2(1u));
+  uvec2 res = uvec2(0u);
 }
 
 void fragment_main() {
@@ -64,23 +34,8 @@
 }
 #version 310 es
 
-uvec2 tint_first_leading_bit(uvec2 v) {
-  uvec2 x = v;
-  uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
-  x = (x >> b16);
-  uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
-  x = (x >> b8);
-  uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
-  x = (x >> b4);
-  uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
-  x = (x >> b2);
-  uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
-  uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
-  return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_6fe804() {
-  uvec2 res = tint_first_leading_bit(uvec2(1u));
+  uvec2 res = uvec2(0u);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.msl
index 05d40cd..51f630e 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.msl
@@ -1,23 +1,8 @@
 #include <metal_stdlib>
 
 using namespace metal;
-uint2 tint_first_leading_bit(uint2 v) {
-  uint2 x = v;
-  uint2 const b16 = select(uint2(0u), uint2(16u), bool2((x & uint2(4294901760u))));
-  x = (x >> b16);
-  uint2 const b8 = select(uint2(0u), uint2(8u), bool2((x & uint2(65280u))));
-  x = (x >> b8);
-  uint2 const b4 = select(uint2(0u), uint2(4u), bool2((x & uint2(240u))));
-  x = (x >> b4);
-  uint2 const b2 = select(uint2(0u), uint2(2u), bool2((x & uint2(12u))));
-  x = (x >> b2);
-  uint2 const b1 = select(uint2(0u), uint2(1u), bool2((x & uint2(2u))));
-  uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u)));
-  return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_6fe804() {
-  uint2 res = tint_first_leading_bit(uint2(1u));
+  uint2 res = uint2(0u);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.spvasm
index c219011..69f043e 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/6fe804.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 97
+; Bound: 32
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -12,9 +12,6 @@
                OpExecutionMode %compute_main LocalSize 1 1 1
                OpName %value "value"
                OpName %vertex_point_size "vertex_point_size"
-               OpName %tint_first_leading_bit "tint_first_leading_bit"
-               OpName %v "v"
-               OpName %x "x"
                OpName %firstLeadingBit_6fe804 "firstLeadingBit_6fe804"
                OpName %res "res"
                OpName %vertex_main_inner "vertex_main_inner"
@@ -31,110 +28,39 @@
 %_ptr_Output_float = OpTypePointer Output %float
           %8 = OpConstantNull %float
 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
        %uint = OpTypeInt 32 0
      %v2uint = OpTypeVector %uint 2
-          %9 = OpTypeFunction %v2uint %v2uint
+         %15 = OpConstantNull %v2uint
 %_ptr_Function_v2uint = OpTypePointer Function %v2uint
-         %17 = OpConstantNull %v2uint
-       %bool = OpTypeBool
-     %v2bool = OpTypeVector %bool 2
-%uint_4294901760 = OpConstant %uint 4294901760
-         %24 = OpConstantComposite %v2uint %uint_4294901760 %uint_4294901760
-    %uint_16 = OpConstant %uint 16
-         %27 = OpConstantComposite %v2uint %uint_16 %uint_16
- %uint_65280 = OpConstant %uint 65280
-         %34 = OpConstantComposite %v2uint %uint_65280 %uint_65280
-     %uint_8 = OpConstant %uint 8
-         %37 = OpConstantComposite %v2uint %uint_8 %uint_8
-   %uint_240 = OpConstant %uint 240
-         %44 = OpConstantComposite %v2uint %uint_240 %uint_240
-     %uint_4 = OpConstant %uint 4
-         %47 = OpConstantComposite %v2uint %uint_4 %uint_4
-    %uint_12 = OpConstant %uint 12
-         %54 = OpConstantComposite %v2uint %uint_12 %uint_12
-     %uint_2 = OpConstant %uint 2
-         %57 = OpConstantComposite %v2uint %uint_2 %uint_2
-     %uint_1 = OpConstant %uint 1
-         %65 = OpConstantComposite %v2uint %uint_1 %uint_1
-%uint_4294967295 = OpConstant %uint 4294967295
-         %70 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295
-       %void = OpTypeVoid
-         %77 = OpTypeFunction %void
-         %83 = OpTypeFunction %v4float
+         %18 = OpTypeFunction %v4float
     %float_1 = OpConstant %float 1
-%tint_first_leading_bit = OpFunction %v2uint None %9
-          %v = OpFunctionParameter %v2uint
-         %14 = OpLabel
-          %x = OpVariable %_ptr_Function_v2uint Function %17
-               OpStore %x %v
-         %22 = OpLoad %v2uint %x
-         %25 = OpBitwiseAnd %v2uint %22 %24
-         %19 = OpINotEqual %v2bool %25 %17
-         %18 = OpSelect %v2uint %19 %27 %17
-         %28 = OpLoad %v2uint %x
-         %29 = OpShiftRightLogical %v2uint %28 %18
-               OpStore %x %29
-         %32 = OpLoad %v2uint %x
-         %35 = OpBitwiseAnd %v2uint %32 %34
-         %31 = OpINotEqual %v2bool %35 %17
-         %30 = OpSelect %v2uint %31 %37 %17
-         %38 = OpLoad %v2uint %x
-         %39 = OpShiftRightLogical %v2uint %38 %30
-               OpStore %x %39
-         %42 = OpLoad %v2uint %x
-         %45 = OpBitwiseAnd %v2uint %42 %44
-         %41 = OpINotEqual %v2bool %45 %17
-         %40 = OpSelect %v2uint %41 %47 %17
-         %48 = OpLoad %v2uint %x
-         %49 = OpShiftRightLogical %v2uint %48 %40
-               OpStore %x %49
-         %52 = OpLoad %v2uint %x
-         %55 = OpBitwiseAnd %v2uint %52 %54
-         %51 = OpINotEqual %v2bool %55 %17
-         %50 = OpSelect %v2uint %51 %57 %17
-         %58 = OpLoad %v2uint %x
-         %59 = OpShiftRightLogical %v2uint %58 %50
-               OpStore %x %59
-         %62 = OpLoad %v2uint %x
-         %63 = OpBitwiseAnd %v2uint %62 %57
-         %61 = OpINotEqual %v2bool %63 %17
-         %60 = OpSelect %v2uint %61 %65 %17
-         %67 = OpLoad %v2uint %x
-         %68 = OpIEqual %v2bool %67 %17
-         %66 = OpSelect %v2uint %68 %70 %17
-         %72 = OpBitwiseOr %v2uint %18 %30
-         %73 = OpBitwiseOr %v2uint %72 %40
-         %74 = OpBitwiseOr %v2uint %73 %50
-         %75 = OpBitwiseOr %v2uint %74 %60
-         %76 = OpBitwiseOr %v2uint %75 %66
-               OpReturnValue %76
-               OpFunctionEnd
-%firstLeadingBit_6fe804 = OpFunction %void None %77
-         %80 = OpLabel
-        %res = OpVariable %_ptr_Function_v2uint Function %17
-         %81 = OpFunctionCall %v2uint %tint_first_leading_bit %65
-               OpStore %res %81
+%firstLeadingBit_6fe804 = OpFunction %void None %9
+         %12 = OpLabel
+        %res = OpVariable %_ptr_Function_v2uint Function %15
+               OpStore %res %15
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %83
-         %85 = OpLabel
-         %86 = OpFunctionCall %void %firstLeadingBit_6fe804
+%vertex_main_inner = OpFunction %v4float None %18
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %firstLeadingBit_6fe804
                OpReturnValue %5
                OpFunctionEnd
-%vertex_main = OpFunction %void None %77
-         %88 = OpLabel
-         %89 = OpFunctionCall %v4float %vertex_main_inner
-               OpStore %value %89
+%vertex_main = OpFunction %void None %9
+         %23 = OpLabel
+         %24 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %24
                OpStore %vertex_point_size %float_1
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %77
-         %92 = OpLabel
-         %93 = OpFunctionCall %void %firstLeadingBit_6fe804
+%fragment_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %firstLeadingBit_6fe804
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %77
-         %95 = OpLabel
-         %96 = OpFunctionCall %void %firstLeadingBit_6fe804
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %firstLeadingBit_6fe804
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.dxc.hlsl
index 0d14118..24723fb 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.dxc.hlsl
@@ -1,20 +1,5 @@
-int2 tint_first_leading_bit(int2 v) {
-  uint2 x = ((v < (0).xx) ? uint2(~(v)) : uint2(v));
-  const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx);
-  x = (x >> b16);
-  const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx);
-  x = (x >> b8);
-  const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx);
-  x = (x >> b4);
-  const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx);
-  x = (x >> b2);
-  const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx);
-  const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx);
-  return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_a622c2() {
-  int2 res = tint_first_leading_bit((1).xx);
+  int2 res = (0).xx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.fxc.hlsl
index 0d14118..24723fb 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.fxc.hlsl
@@ -1,20 +1,5 @@
-int2 tint_first_leading_bit(int2 v) {
-  uint2 x = ((v < (0).xx) ? uint2(~(v)) : uint2(v));
-  const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx);
-  x = (x >> b16);
-  const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx);
-  x = (x >> b8);
-  const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx);
-  x = (x >> b4);
-  const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx);
-  x = (x >> b2);
-  const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx);
-  const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx);
-  return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_a622c2() {
-  int2 res = tint_first_leading_bit((1).xx);
+  int2 res = (0).xx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.glsl
index d08c21d..276d3d7 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.glsl
@@ -1,22 +1,7 @@
 #version 310 es
 
-ivec2 tint_first_leading_bit(ivec2 v) {
-  uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0)));
-  uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
-  x = (x >> b16);
-  uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
-  x = (x >> b8);
-  uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
-  x = (x >> b4);
-  uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
-  x = (x >> b2);
-  uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
-  uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
-  return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_a622c2() {
-  ivec2 res = tint_first_leading_bit(ivec2(1));
+  ivec2 res = ivec2(0);
 }
 
 vec4 vertex_main() {
@@ -35,23 +20,8 @@
 #version 310 es
 precision mediump float;
 
-ivec2 tint_first_leading_bit(ivec2 v) {
-  uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0)));
-  uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
-  x = (x >> b16);
-  uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
-  x = (x >> b8);
-  uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
-  x = (x >> b4);
-  uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
-  x = (x >> b2);
-  uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
-  uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
-  return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_a622c2() {
-  ivec2 res = tint_first_leading_bit(ivec2(1));
+  ivec2 res = ivec2(0);
 }
 
 void fragment_main() {
@@ -64,23 +34,8 @@
 }
 #version 310 es
 
-ivec2 tint_first_leading_bit(ivec2 v) {
-  uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0)));
-  uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
-  x = (x >> b16);
-  uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
-  x = (x >> b8);
-  uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
-  x = (x >> b4);
-  uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
-  x = (x >> b2);
-  uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
-  uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
-  return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_a622c2() {
-  ivec2 res = tint_first_leading_bit(ivec2(1));
+  ivec2 res = ivec2(0);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.msl
index f0372368..4edc0fd 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.msl
@@ -1,23 +1,8 @@
 #include <metal_stdlib>
 
 using namespace metal;
-int2 tint_first_leading_bit(int2 v) {
-  uint2 x = select(uint2(v), uint2(~(v)), (v < int2(0)));
-  uint2 const b16 = select(uint2(0u), uint2(16u), bool2((x & uint2(4294901760u))));
-  x = (x >> b16);
-  uint2 const b8 = select(uint2(0u), uint2(8u), bool2((x & uint2(65280u))));
-  x = (x >> b8);
-  uint2 const b4 = select(uint2(0u), uint2(4u), bool2((x & uint2(240u))));
-  x = (x >> b4);
-  uint2 const b2 = select(uint2(0u), uint2(2u), bool2((x & uint2(12u))));
-  x = (x >> b2);
-  uint2 const b1 = select(uint2(0u), uint2(1u), bool2((x & uint2(2u))));
-  uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u)));
-  return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_a622c2() {
-  int2 res = tint_first_leading_bit(int2(1));
+  int2 res = int2(0);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.spvasm
index 30f8811..f8d27c1 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/a622c2.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 108
+; Bound: 32
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -12,9 +12,6 @@
                OpExecutionMode %compute_main LocalSize 1 1 1
                OpName %value "value"
                OpName %vertex_point_size "vertex_point_size"
-               OpName %tint_first_leading_bit "tint_first_leading_bit"
-               OpName %v "v"
-               OpName %x "x"
                OpName %firstLeadingBit_a622c2 "firstLeadingBit_a622c2"
                OpName %res "res"
                OpName %vertex_main_inner "vertex_main_inner"
@@ -31,122 +28,39 @@
 %_ptr_Output_float = OpTypePointer Output %float
           %8 = OpConstantNull %float
 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
         %int = OpTypeInt 32 1
       %v2int = OpTypeVector %int 2
-          %9 = OpTypeFunction %v2int %v2int
-       %uint = OpTypeInt 32 0
-     %v2uint = OpTypeVector %uint 2
-         %18 = OpConstantNull %v2int
-       %bool = OpTypeBool
-     %v2bool = OpTypeVector %bool 2
-%_ptr_Function_v2uint = OpTypePointer Function %v2uint
-         %27 = OpConstantNull %v2uint
-%uint_4294901760 = OpConstant %uint 4294901760
-         %32 = OpConstantComposite %v2uint %uint_4294901760 %uint_4294901760
-    %uint_16 = OpConstant %uint 16
-         %35 = OpConstantComposite %v2uint %uint_16 %uint_16
- %uint_65280 = OpConstant %uint 65280
-         %42 = OpConstantComposite %v2uint %uint_65280 %uint_65280
-     %uint_8 = OpConstant %uint 8
-         %45 = OpConstantComposite %v2uint %uint_8 %uint_8
-   %uint_240 = OpConstant %uint 240
-         %52 = OpConstantComposite %v2uint %uint_240 %uint_240
-     %uint_4 = OpConstant %uint 4
-         %55 = OpConstantComposite %v2uint %uint_4 %uint_4
-    %uint_12 = OpConstant %uint 12
-         %62 = OpConstantComposite %v2uint %uint_12 %uint_12
-     %uint_2 = OpConstant %uint 2
-         %65 = OpConstantComposite %v2uint %uint_2 %uint_2
-     %uint_1 = OpConstant %uint 1
-         %73 = OpConstantComposite %v2uint %uint_1 %uint_1
-%uint_4294967295 = OpConstant %uint 4294967295
-         %78 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295
-       %void = OpTypeVoid
-         %85 = OpTypeFunction %void
-      %int_1 = OpConstant %int 1
-         %91 = OpConstantComposite %v2int %int_1 %int_1
+         %15 = OpConstantNull %v2int
 %_ptr_Function_v2int = OpTypePointer Function %v2int
-         %94 = OpTypeFunction %v4float
+         %18 = OpTypeFunction %v4float
     %float_1 = OpConstant %float 1
-%tint_first_leading_bit = OpFunction %v2int None %9
-          %v = OpFunctionParameter %v2int
-         %14 = OpLabel
-          %x = OpVariable %_ptr_Function_v2uint Function %27
-         %19 = OpSLessThan %v2bool %v %18
-         %23 = OpNot %v2int %v
-         %22 = OpBitcast %v2uint %23
-         %24 = OpBitcast %v2uint %v
-         %15 = OpSelect %v2uint %19 %22 %24
-               OpStore %x %15
-         %30 = OpLoad %v2uint %x
-         %33 = OpBitwiseAnd %v2uint %30 %32
-         %29 = OpINotEqual %v2bool %33 %27
-         %28 = OpSelect %v2uint %29 %35 %27
-         %36 = OpLoad %v2uint %x
-         %37 = OpShiftRightLogical %v2uint %36 %28
-               OpStore %x %37
-         %40 = OpLoad %v2uint %x
-         %43 = OpBitwiseAnd %v2uint %40 %42
-         %39 = OpINotEqual %v2bool %43 %27
-         %38 = OpSelect %v2uint %39 %45 %27
-         %46 = OpLoad %v2uint %x
-         %47 = OpShiftRightLogical %v2uint %46 %38
-               OpStore %x %47
-         %50 = OpLoad %v2uint %x
-         %53 = OpBitwiseAnd %v2uint %50 %52
-         %49 = OpINotEqual %v2bool %53 %27
-         %48 = OpSelect %v2uint %49 %55 %27
-         %56 = OpLoad %v2uint %x
-         %57 = OpShiftRightLogical %v2uint %56 %48
-               OpStore %x %57
-         %60 = OpLoad %v2uint %x
-         %63 = OpBitwiseAnd %v2uint %60 %62
-         %59 = OpINotEqual %v2bool %63 %27
-         %58 = OpSelect %v2uint %59 %65 %27
-         %66 = OpLoad %v2uint %x
-         %67 = OpShiftRightLogical %v2uint %66 %58
-               OpStore %x %67
-         %70 = OpLoad %v2uint %x
-         %71 = OpBitwiseAnd %v2uint %70 %65
-         %69 = OpINotEqual %v2bool %71 %27
-         %68 = OpSelect %v2uint %69 %73 %27
-         %75 = OpLoad %v2uint %x
-         %76 = OpIEqual %v2bool %75 %27
-         %74 = OpSelect %v2uint %76 %78 %27
-         %80 = OpBitwiseOr %v2uint %28 %38
-         %81 = OpBitwiseOr %v2uint %80 %48
-         %82 = OpBitwiseOr %v2uint %81 %58
-         %83 = OpBitwiseOr %v2uint %82 %68
-         %84 = OpBitwiseOr %v2uint %83 %74
-         %79 = OpBitcast %v2int %84
-               OpReturnValue %79
-               OpFunctionEnd
-%firstLeadingBit_a622c2 = OpFunction %void None %85
-         %88 = OpLabel
-        %res = OpVariable %_ptr_Function_v2int Function %18
-         %89 = OpFunctionCall %v2int %tint_first_leading_bit %91
-               OpStore %res %89
+%firstLeadingBit_a622c2 = OpFunction %void None %9
+         %12 = OpLabel
+        %res = OpVariable %_ptr_Function_v2int Function %15
+               OpStore %res %15
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %94
-         %96 = OpLabel
-         %97 = OpFunctionCall %void %firstLeadingBit_a622c2
+%vertex_main_inner = OpFunction %v4float None %18
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %firstLeadingBit_a622c2
                OpReturnValue %5
                OpFunctionEnd
-%vertex_main = OpFunction %void None %85
-         %99 = OpLabel
-        %100 = OpFunctionCall %v4float %vertex_main_inner
-               OpStore %value %100
+%vertex_main = OpFunction %void None %9
+         %23 = OpLabel
+         %24 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %24
                OpStore %vertex_point_size %float_1
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %85
-        %103 = OpLabel
-        %104 = OpFunctionCall %void %firstLeadingBit_a622c2
+%fragment_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %firstLeadingBit_a622c2
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %85
-        %106 = OpLabel
-        %107 = OpFunctionCall %void %firstLeadingBit_a622c2
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %firstLeadingBit_a622c2
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.dxc.hlsl
index 0141012..79d7e98 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.dxc.hlsl
@@ -1,20 +1,5 @@
-int4 tint_first_leading_bit(int4 v) {
-  uint4 x = ((v < (0).xxxx) ? uint4(~(v)) : uint4(v));
-  const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx);
-  x = (x >> b16);
-  const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx);
-  x = (x >> b8);
-  const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx);
-  x = (x >> b4);
-  const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx);
-  x = (x >> b2);
-  const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx);
-  const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx);
-  return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_c1f940() {
-  int4 res = tint_first_leading_bit((1).xxxx);
+  int4 res = (0).xxxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.fxc.hlsl
index 0141012..79d7e98 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.fxc.hlsl
@@ -1,20 +1,5 @@
-int4 tint_first_leading_bit(int4 v) {
-  uint4 x = ((v < (0).xxxx) ? uint4(~(v)) : uint4(v));
-  const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx);
-  x = (x >> b16);
-  const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx);
-  x = (x >> b8);
-  const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx);
-  x = (x >> b4);
-  const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx);
-  x = (x >> b2);
-  const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx);
-  const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx);
-  return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_c1f940() {
-  int4 res = tint_first_leading_bit((1).xxxx);
+  int4 res = (0).xxxx;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.glsl
index 54a22fe..94bfed3 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.glsl
@@ -1,22 +1,7 @@
 #version 310 es
 
-ivec4 tint_first_leading_bit(ivec4 v) {
-  uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0)));
-  uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
-  x = (x >> b16);
-  uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
-  x = (x >> b8);
-  uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
-  x = (x >> b4);
-  uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
-  x = (x >> b2);
-  uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
-  uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
-  return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_c1f940() {
-  ivec4 res = tint_first_leading_bit(ivec4(1));
+  ivec4 res = ivec4(0);
 }
 
 vec4 vertex_main() {
@@ -35,23 +20,8 @@
 #version 310 es
 precision mediump float;
 
-ivec4 tint_first_leading_bit(ivec4 v) {
-  uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0)));
-  uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
-  x = (x >> b16);
-  uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
-  x = (x >> b8);
-  uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
-  x = (x >> b4);
-  uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
-  x = (x >> b2);
-  uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
-  uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
-  return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_c1f940() {
-  ivec4 res = tint_first_leading_bit(ivec4(1));
+  ivec4 res = ivec4(0);
 }
 
 void fragment_main() {
@@ -64,23 +34,8 @@
 }
 #version 310 es
 
-ivec4 tint_first_leading_bit(ivec4 v) {
-  uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0)));
-  uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
-  x = (x >> b16);
-  uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
-  x = (x >> b8);
-  uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
-  x = (x >> b4);
-  uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
-  x = (x >> b2);
-  uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
-  uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
-  return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_c1f940() {
-  ivec4 res = tint_first_leading_bit(ivec4(1));
+  ivec4 res = ivec4(0);
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.msl
index dd07d58..4b58a2f 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.msl
@@ -1,23 +1,8 @@
 #include <metal_stdlib>
 
 using namespace metal;
-int4 tint_first_leading_bit(int4 v) {
-  uint4 x = select(uint4(v), uint4(~(v)), (v < int4(0)));
-  uint4 const b16 = select(uint4(0u), uint4(16u), bool4((x & uint4(4294901760u))));
-  x = (x >> b16);
-  uint4 const b8 = select(uint4(0u), uint4(8u), bool4((x & uint4(65280u))));
-  x = (x >> b8);
-  uint4 const b4 = select(uint4(0u), uint4(4u), bool4((x & uint4(240u))));
-  x = (x >> b4);
-  uint4 const b2 = select(uint4(0u), uint4(2u), bool4((x & uint4(12u))));
-  x = (x >> b2);
-  uint4 const b1 = select(uint4(0u), uint4(1u), bool4((x & uint4(2u))));
-  uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u)));
-  return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_c1f940() {
-  int4 res = tint_first_leading_bit(int4(1));
+  int4 res = int4(0);
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.spvasm
index 2840b3b..2a95961 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/c1f940.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 108
+; Bound: 32
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -12,9 +12,6 @@
                OpExecutionMode %compute_main LocalSize 1 1 1
                OpName %value "value"
                OpName %vertex_point_size "vertex_point_size"
-               OpName %tint_first_leading_bit "tint_first_leading_bit"
-               OpName %v "v"
-               OpName %x "x"
                OpName %firstLeadingBit_c1f940 "firstLeadingBit_c1f940"
                OpName %res "res"
                OpName %vertex_main_inner "vertex_main_inner"
@@ -31,122 +28,39 @@
 %_ptr_Output_float = OpTypePointer Output %float
           %8 = OpConstantNull %float
 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
+       %void = OpTypeVoid
+          %9 = OpTypeFunction %void
         %int = OpTypeInt 32 1
       %v4int = OpTypeVector %int 4
-          %9 = OpTypeFunction %v4int %v4int
-       %uint = OpTypeInt 32 0
-     %v4uint = OpTypeVector %uint 4
-         %18 = OpConstantNull %v4int
-       %bool = OpTypeBool
-     %v4bool = OpTypeVector %bool 4
-%_ptr_Function_v4uint = OpTypePointer Function %v4uint
-         %27 = OpConstantNull %v4uint
-%uint_4294901760 = OpConstant %uint 4294901760
-         %32 = OpConstantComposite %v4uint %uint_4294901760 %uint_4294901760 %uint_4294901760 %uint_4294901760
-    %uint_16 = OpConstant %uint 16
-         %35 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16
- %uint_65280 = OpConstant %uint 65280
-         %42 = OpConstantComposite %v4uint %uint_65280 %uint_65280 %uint_65280 %uint_65280
-     %uint_8 = OpConstant %uint 8
-         %45 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8
-   %uint_240 = OpConstant %uint 240
-         %52 = OpConstantComposite %v4uint %uint_240 %uint_240 %uint_240 %uint_240
-     %uint_4 = OpConstant %uint 4
-         %55 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4
-    %uint_12 = OpConstant %uint 12
-         %62 = OpConstantComposite %v4uint %uint_12 %uint_12 %uint_12 %uint_12
-     %uint_2 = OpConstant %uint 2
-         %65 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2
-     %uint_1 = OpConstant %uint 1
-         %73 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
-%uint_4294967295 = OpConstant %uint 4294967295
-         %78 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295
-       %void = OpTypeVoid
-         %85 = OpTypeFunction %void
-      %int_1 = OpConstant %int 1
-         %91 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
+         %15 = OpConstantNull %v4int
 %_ptr_Function_v4int = OpTypePointer Function %v4int
-         %94 = OpTypeFunction %v4float
+         %18 = OpTypeFunction %v4float
     %float_1 = OpConstant %float 1
-%tint_first_leading_bit = OpFunction %v4int None %9
-          %v = OpFunctionParameter %v4int
-         %14 = OpLabel
-          %x = OpVariable %_ptr_Function_v4uint Function %27
-         %19 = OpSLessThan %v4bool %v %18
-         %23 = OpNot %v4int %v
-         %22 = OpBitcast %v4uint %23
-         %24 = OpBitcast %v4uint %v
-         %15 = OpSelect %v4uint %19 %22 %24
-               OpStore %x %15
-         %30 = OpLoad %v4uint %x
-         %33 = OpBitwiseAnd %v4uint %30 %32
-         %29 = OpINotEqual %v4bool %33 %27
-         %28 = OpSelect %v4uint %29 %35 %27
-         %36 = OpLoad %v4uint %x
-         %37 = OpShiftRightLogical %v4uint %36 %28
-               OpStore %x %37
-         %40 = OpLoad %v4uint %x
-         %43 = OpBitwiseAnd %v4uint %40 %42
-         %39 = OpINotEqual %v4bool %43 %27
-         %38 = OpSelect %v4uint %39 %45 %27
-         %46 = OpLoad %v4uint %x
-         %47 = OpShiftRightLogical %v4uint %46 %38
-               OpStore %x %47
-         %50 = OpLoad %v4uint %x
-         %53 = OpBitwiseAnd %v4uint %50 %52
-         %49 = OpINotEqual %v4bool %53 %27
-         %48 = OpSelect %v4uint %49 %55 %27
-         %56 = OpLoad %v4uint %x
-         %57 = OpShiftRightLogical %v4uint %56 %48
-               OpStore %x %57
-         %60 = OpLoad %v4uint %x
-         %63 = OpBitwiseAnd %v4uint %60 %62
-         %59 = OpINotEqual %v4bool %63 %27
-         %58 = OpSelect %v4uint %59 %65 %27
-         %66 = OpLoad %v4uint %x
-         %67 = OpShiftRightLogical %v4uint %66 %58
-               OpStore %x %67
-         %70 = OpLoad %v4uint %x
-         %71 = OpBitwiseAnd %v4uint %70 %65
-         %69 = OpINotEqual %v4bool %71 %27
-         %68 = OpSelect %v4uint %69 %73 %27
-         %75 = OpLoad %v4uint %x
-         %76 = OpIEqual %v4bool %75 %27
-         %74 = OpSelect %v4uint %76 %78 %27
-         %80 = OpBitwiseOr %v4uint %28 %38
-         %81 = OpBitwiseOr %v4uint %80 %48
-         %82 = OpBitwiseOr %v4uint %81 %58
-         %83 = OpBitwiseOr %v4uint %82 %68
-         %84 = OpBitwiseOr %v4uint %83 %74
-         %79 = OpBitcast %v4int %84
-               OpReturnValue %79
-               OpFunctionEnd
-%firstLeadingBit_c1f940 = OpFunction %void None %85
-         %88 = OpLabel
-        %res = OpVariable %_ptr_Function_v4int Function %18
-         %89 = OpFunctionCall %v4int %tint_first_leading_bit %91
-               OpStore %res %89
+%firstLeadingBit_c1f940 = OpFunction %void None %9
+         %12 = OpLabel
+        %res = OpVariable %_ptr_Function_v4int Function %15
+               OpStore %res %15
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %94
-         %96 = OpLabel
-         %97 = OpFunctionCall %void %firstLeadingBit_c1f940
+%vertex_main_inner = OpFunction %v4float None %18
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %firstLeadingBit_c1f940
                OpReturnValue %5
                OpFunctionEnd
-%vertex_main = OpFunction %void None %85
-         %99 = OpLabel
-        %100 = OpFunctionCall %v4float %vertex_main_inner
-               OpStore %value %100
+%vertex_main = OpFunction %void None %9
+         %23 = OpLabel
+         %24 = OpFunctionCall %v4float %vertex_main_inner
+               OpStore %value %24
                OpStore %vertex_point_size %float_1
                OpReturn
                OpFunctionEnd
-%fragment_main = OpFunction %void None %85
-        %103 = OpLabel
-        %104 = OpFunctionCall %void %firstLeadingBit_c1f940
+%fragment_main = OpFunction %void None %9
+         %27 = OpLabel
+         %28 = OpFunctionCall %void %firstLeadingBit_c1f940
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %85
-        %106 = OpLabel
-        %107 = OpFunctionCall %void %firstLeadingBit_c1f940
+%compute_main = OpFunction %void None %9
+         %30 = OpLabel
+         %31 = OpFunctionCall %void %firstLeadingBit_c1f940
                OpReturn
                OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.dxc.hlsl
index e289038..f635198 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.dxc.hlsl
@@ -1,20 +1,5 @@
-uint tint_first_leading_bit(uint v) {
-  uint x = v;
-  const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
-  x = (x >> b16);
-  const uint b8 = (bool((x & 65280u)) ? 8u : 0u);
-  x = (x >> b8);
-  const uint b4 = (bool((x & 240u)) ? 4u : 0u);
-  x = (x >> b4);
-  const uint b2 = (bool((x & 12u)) ? 2u : 0u);
-  x = (x >> b2);
-  const uint b1 = (bool((x & 2u)) ? 1u : 0u);
-  const uint is_zero = ((x == 0u) ? 4294967295u : 0u);
-  return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_f0779d() {
-  uint res = tint_first_leading_bit(1u);
+  uint res = 0u;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.fxc.hlsl
index e289038..f635198 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.fxc.hlsl
@@ -1,20 +1,5 @@
-uint tint_first_leading_bit(uint v) {
-  uint x = v;
-  const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
-  x = (x >> b16);
-  const uint b8 = (bool((x & 65280u)) ? 8u : 0u);
-  x = (x >> b8);
-  const uint b4 = (bool((x & 240u)) ? 4u : 0u);
-  x = (x >> b4);
-  const uint b2 = (bool((x & 12u)) ? 2u : 0u);
-  x = (x >> b2);
-  const uint b1 = (bool((x & 2u)) ? 1u : 0u);
-  const uint is_zero = ((x == 0u) ? 4294967295u : 0u);
-  return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_f0779d() {
-  uint res = tint_first_leading_bit(1u);
+  uint res = 0u;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.glsl
index 76aee67..55b2bdc 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.glsl
@@ -1,22 +1,7 @@
 #version 310 es
 
-uint tint_first_leading_bit(uint v) {
-  uint x = v;
-  uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
-  x = (x >> b16);
-  uint b8 = (bool((x & 65280u)) ? 8u : 0u);
-  x = (x >> b8);
-  uint b4 = (bool((x & 240u)) ? 4u : 0u);
-  x = (x >> b4);
-  uint b2 = (bool((x & 12u)) ? 2u : 0u);
-  x = (x >> b2);
-  uint b1 = (bool((x & 2u)) ? 1u : 0u);
-  uint is_zero = ((x == 0u) ? 4294967295u : 0u);
-  return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_f0779d() {
-  uint res = tint_first_leading_bit(1u);
+  uint res = 0u;
 }
 
 vec4 vertex_main() {
@@ -35,23 +20,8 @@
 #version 310 es
 precision mediump float;
 
-uint tint_first_leading_bit(uint v) {
-  uint x = v;
-  uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
-  x = (x >> b16);
-  uint b8 = (bool((x & 65280u)) ? 8u : 0u);
-  x = (x >> b8);
-  uint b4 = (bool((x & 240u)) ? 4u : 0u);
-  x = (x >> b4);
-  uint b2 = (bool((x & 12u)) ? 2u : 0u);
-  x = (x >> b2);
-  uint b1 = (bool((x & 2u)) ? 1u : 0u);
-  uint is_zero = ((x == 0u) ? 4294967295u : 0u);
-  return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_f0779d() {
-  uint res = tint_first_leading_bit(1u);
+  uint res = 0u;
 }
 
 void fragment_main() {
@@ -64,23 +34,8 @@
 }
 #version 310 es
 
-uint tint_first_leading_bit(uint v) {
-  uint x = v;
-  uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
-  x = (x >> b16);
-  uint b8 = (bool((x & 65280u)) ? 8u : 0u);
-  x = (x >> b8);
-  uint b4 = (bool((x & 240u)) ? 4u : 0u);
-  x = (x >> b4);
-  uint b2 = (bool((x & 12u)) ? 2u : 0u);
-  x = (x >> b2);
-  uint b1 = (bool((x & 2u)) ? 1u : 0u);
-  uint is_zero = ((x == 0u) ? 4294967295u : 0u);
-  return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_f0779d() {
-  uint res = tint_first_leading_bit(1u);
+  uint res = 0u;
 }
 
 void compute_main() {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.msl b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.msl
index 09b520d..b673c0b 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.msl
@@ -1,23 +1,8 @@
 #include <metal_stdlib>
 
 using namespace metal;
-uint tint_first_leading_bit(uint v) {
-  uint x = v;
-  uint const b16 = select(0u, 16u, bool((x & 4294901760u)));
-  x = (x >> b16);
-  uint const b8 = select(0u, 8u, bool((x & 65280u)));
-  x = (x >> b8);
-  uint const b4 = select(0u, 4u, bool((x & 240u)));
-  x = (x >> b4);
-  uint const b2 = select(0u, 2u, bool((x & 12u)));
-  x = (x >> b2);
-  uint const b1 = select(0u, 1u, bool((x & 2u)));
-  uint const is_zero = select(0u, 4294967295u, (x == 0u));
-  return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
-}
-
 void firstLeadingBit_f0779d() {
-  uint res = tint_first_leading_bit(1u);
+  uint res = 0u;
 }
 
 struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.spvasm
index c51a21b..227a546 100644
--- a/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/firstLeadingBit/f0779d.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
 ; SPIR-V
 ; Version: 1.3
 ; Generator: Google Tint Compiler; 0
-; Bound: 85
+; Bound: 31
 ; Schema: 0
                OpCapability Shader
                OpMemoryModel Logical GLSL450
@@ -12,9 +12,6 @@
                OpExecutionMode %compute_main LocalSize 1 1 1
                OpName %value "value"
                OpName %vertex_point_size "vertex_point_size"
-               OpName %tint_first_leading_bit "tint_first_leading_bit"
-               OpName %v "v"
-               OpName %x "x"
                OpName %firstLeadingBit_f0779d "firstLeadingBit_f0779d"
                OpName %res "res"
                OpName %vertex_main_inner "vertex_main_inner"
@@ -31,98 +28,38 @@
 %_ptr_Output_float = OpTypePointer Output %float
           %8 = OpConstantNull %float
 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
-       %uint = OpTypeInt 32 0
-          %9 = OpTypeFunction %uint %uint
-%_ptr_Function_uint = OpTypePointer Function %uint
-         %16 = OpConstantNull %uint
-       %bool = OpTypeBool
-%uint_4294901760 = OpConstant %uint 4294901760
-    %uint_16 = OpConstant %uint 16
- %uint_65280 = OpConstant %uint 65280
-     %uint_8 = OpConstant %uint 8
-   %uint_240 = OpConstant %uint 240
-     %uint_4 = OpConstant %uint 4
-    %uint_12 = OpConstant %uint 12
-     %uint_2 = OpConstant %uint 2
-     %uint_1 = OpConstant %uint 1
-%uint_4294967295 = OpConstant %uint 4294967295
        %void = OpTypeVoid
-         %65 = OpTypeFunction %void
-         %71 = OpTypeFunction %v4float
+          %9 = OpTypeFunction %void
+       %uint = OpTypeInt 32 0
+         %14 = OpConstantNull %uint
+%_ptr_Function_uint = OpTypePointer Function %uint
+         %17 = OpTypeFunction %v4float
     %float_1 = OpConstant %float 1
-%tint_first_leading_bit = OpFunction %uint None %9
-          %v = OpFunctionParameter %uint
-         %13 = OpLabel
-          %x = OpVariable %_ptr_Function_uint Function %16
-               OpStore %x %v
-         %20 = OpLoad %uint %x
-         %22 = OpBitwiseAnd %uint %20 %uint_4294901760
-         %18 = OpINotEqual %bool %22 %16
-         %17 = OpSelect %uint %18 %uint_16 %16
-         %24 = OpLoad %uint %x
-         %25 = OpShiftRightLogical %uint %24 %17
-               OpStore %x %25
-         %28 = OpLoad %uint %x
-         %30 = OpBitwiseAnd %uint %28 %uint_65280
-         %27 = OpINotEqual %bool %30 %16
-         %26 = OpSelect %uint %27 %uint_8 %16
-         %32 = OpLoad %uint %x
-         %33 = OpShiftRightLogical %uint %32 %26
-               OpStore %x %33
-         %36 = OpLoad %uint %x
-         %38 = OpBitwiseAnd %uint %36 %uint_240
-         %35 = OpINotEqual %bool %38 %16
-         %34 = OpSelect %uint %35 %uint_4 %16
-         %40 = OpLoad %uint %x
-         %41 = OpShiftRightLogical %uint %40 %34
-               OpStore %x %41
-         %44 = OpLoad %uint %x
-         %46 = OpBitwiseAnd %uint %44 %uint_12
-         %43 = OpINotEqual %bool %46 %16
-         %42 = OpSelect %uint %43 %uint_2 %16
-         %48 = OpLoad %uint %x
-         %49 = OpShiftRightLogical %uint %48 %42
-               OpStore %x %49
-         %52 = OpLoad %uint %x
-         %53 = OpBitwiseAnd %uint %52 %uint_2
-         %51 = OpINotEqual %bool %53 %16
-         %50 = OpSelect %uint %51 %uint_1 %16
-         %56 = OpLoad %uint %x
-         %57 = OpIEqual %bool %56 %16
-         %55 = OpSelect %uint %57 %uint_4294967295 %16
-         %60 = OpBitwiseOr %uint %17 %26
-         %61 = OpBitwiseOr %uint %60 %34
-         %62 = OpBitwiseOr %uint %61 %42
-         %63 = OpBitwiseOr %uint %62 %50
-         %64 = OpBitwiseOr %uint %63 %55
-               OpReturnValue %64
-               OpFunctionEnd
-%firstLeadingBit_f0779d = OpFunction %void None %65
-         %68 = OpLabel
-        %res = OpVariable %_ptr_Function_uint Function %16
-         %69 = OpFunctionCall %uint %tint_first_leading_bit %uint_1
-               OpStore %res %69
+%firstLeadingBit_f0779d = OpFunction %void None %9
+         %12 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %14
+               OpStore %res %14
                OpReturn
                OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %71
-         %73 = OpLabel
-         %74 = OpFunctionCall %void %firstLeadingBit_f0779d
+%vertex_main_inner = OpFunction %v4float None %17
+         %19 = OpLabel
+         %20 = OpFunctionCall %void %firstLeadingBit_f0779d
                OpReturnValue %5
                OpFunctionEnd
-%vertex_main = OpFunction %void None %65
-         %76 = OpLabel
-         %77 = OpFunctionCall %v4float %vertex_main_inner
-               OpStore %value %77
+%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 %65
-         %80 = OpLabel
-         %81 = OpFunctionCall %void %firstLeadingBit_f0779d
+%fragment_main = OpFunction %void None %9
+         %26 = OpLabel
+         %27 = OpFunctionCall %void %firstLeadingBit_f0779d
                OpReturn
                OpFunctionEnd
-%compute_main = OpFunction %void None %65
-         %83 = OpLabel
-         %84 = OpFunctionCall %void %firstLeadingBit_f0779d
+%compute_main = OpFunction %void None %9
+         %29 = OpLabel
+         %30 = OpFunctionCall %void %firstLeadingBit_f0779d
                OpReturn
                OpFunctionEnd
diff --git a/webgpu-cts/expectations.txt b/webgpu-cts/expectations.txt
index 7abcaaf..f7170a6 100644
--- a/webgpu-cts/expectations.txt
+++ b/webgpu-cts/expectations.txt
@@ -494,14 +494,6 @@
 crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="const";width=2 [ Failure ]
 crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="const";width=3 [ Failure ]
 crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,extractBits:u32:inputSource="const";width=4 [ Failure ]
-crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="const";vectorize="_undef_" [ Failure ]
-crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="const";vectorize=2 [ Failure ]
-crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="const";vectorize=3 [ Failure ]
-crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,firstLeadingBit:i32:inputSource="const";vectorize=4 [ Failure ]
-crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="const";vectorize="_undef_" [ Failure ]
-crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="const";vectorize=2 [ Failure ]
-crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="const";vectorize=3 [ Failure ]
-crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,firstLeadingBit:u32:inputSource="const";vectorize=4 [ Failure ]
 crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="const";vectorize="_undef_" [ Failure ]
 crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="const";vectorize=2 [ Failure ]
 crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,firstTrailingBit:i32:inputSource="const";vectorize=3 [ Failure ]