// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the empecific language governing permissions and
// limitations under the License.

#include "src/tint/resolver/const_eval_test.h"

#include "src/tint/utils/result.h"

using namespace tint::number_suffixes;  // NOLINT
using ::testing::HasSubstr;

namespace tint::resolver {
namespace {

// Bring in std::ostream& operator<<(std::ostream& o, const Types& types)
using resolver::operator<<;

struct Case {
    Case(utils::VectorRef<Types> in_args, utils::VectorRef<Types> expected_values)
        : args(std::move(in_args)),
          expected(Success{std::move(expected_values), CheckConstantFlags{}}) {}

    Case(utils::VectorRef<Types> in_args, std::string expected_err)
        : args(std::move(in_args)), expected(Failure{std::move(expected_err)}) {}

    /// Expected value may be positive or negative
    Case& PosOrNeg() {
        Success s = expected.Get();
        s.flags.pos_or_neg = true;
        expected = s;
        return *this;
    }

    /// Expected value should be compared using EXPECT_FLOAT_EQ instead of EXPECT_EQ.
    /// If optional epsilon is passed in, will be compared using EXPECT_NEAR with that epsilon.
    Case& FloatComp(std::optional<double> epsilon = {}) {
        Success s = expected.Get();
        s.flags.float_compare = true;
        s.flags.float_compare_epsilon = epsilon;
        expected = s;
        return *this;
    }

    struct Success {
        utils::Vector<Types, 2> values;
        CheckConstantFlags flags;
    };
    struct Failure {
        std::string error;
    };

    utils::Vector<Types, 8> args;
    utils::Result<Success, Failure> expected;
};

static std::ostream& operator<<(std::ostream& o, const Case& c) {
    o << "args: ";
    for (auto& a : c.args) {
        o << a << ", ";
    }
    o << "expected: ";
    if (c.expected) {
        auto s = c.expected.Get();
        if (s.values.Length() == 1) {
            o << s.values[0];
        } else {
            o << "[";
            for (auto& v : s.values) {
                if (&v != &s.values[0]) {
                    o << ", ";
                }
                o << v;
            }
            o << "]";
        }
        o << ", pos_or_neg: " << s.flags.pos_or_neg;
        o << ", float_compare: " << s.flags.float_compare;
    } else {
        o << "[ERROR: " << c.expected.Failure().error << "]";
    }
    return o;
}

using ScalarTypes = std::variant<AInt, AFloat, u32, i32, f32, f16>;

/// Creates a Case with Values for args and result
static Case C(std::initializer_list<Types> args, Types result) {
    return Case{utils::Vector<Types, 8>{args}, utils::Vector<Types, 2>{std::move(result)}};
}

/// Creates a Case with Values for args and result
static Case C(std::initializer_list<Types> args, std::initializer_list<Types> results) {
    return Case{utils::Vector<Types, 8>{args}, utils::Vector<Types, 2>{results}};
}

/// Convenience overload that creates a Case with just scalars
static Case C(std::initializer_list<ScalarTypes> sargs, ScalarTypes sresult) {
    utils::Vector<Types, 8> args;
    for (auto& sa : sargs) {
        std::visit([&](auto&& v) { return args.Push(Val(v)); }, sa);
    }
    Types result = Val(0_a);
    std::visit([&](auto&& v) { result = Val(v); }, sresult);
    return Case{std::move(args), utils::Vector<Types, 2>{std::move(result)}};
}

/// Creates a Case with Values for args and result
static Case C(std::initializer_list<ScalarTypes> sargs,
              std::initializer_list<ScalarTypes> sresults) {
    utils::Vector<Types, 8> args;
    for (auto& sa : sargs) {
        std::visit([&](auto&& v) { return args.Push(Val(v)); }, sa);
    }
    utils::Vector<Types, 2> results;
    for (auto& sa : sresults) {
        std::visit([&](auto&& v) { return results.Push(Val(v)); }, sa);
    }
    return Case{std::move(args), std::move(results)};
}

/// Creates a Case with Values for args and expected error
static Case E(std::initializer_list<Types> args, std::string err) {
    return Case{utils::Vector<Types, 8>{args}, std::move(err)};
}

/// Convenience overload that creates an expected-error Case with just scalars
static Case E(std::initializer_list<ScalarTypes> sargs, std::string err) {
    utils::Vector<Types, 8> args;
    for (auto& sa : sargs) {
        std::visit([&](auto&& v) { return args.Push(Val(v)); }, sa);
    }
    return Case{std::move(args), std::move(err)};
}

using ResolverConstEvalBuiltinTest = ResolverTestWithParam<std::tuple<sem::BuiltinType, Case>>;

TEST_P(ResolverConstEvalBuiltinTest, Test) {
    Enable(ast::Extension::kF16);

    auto builtin = std::get<0>(GetParam());
    auto& c = std::get<1>(GetParam());

    utils::Vector<const ast::Expression*, 8> args;
    for (auto& a : c.args) {
        std::visit([&](auto&& v) { args.Push(v.Expr(*this)); }, a);
    }

    auto* expr = Call(Source{{12, 34}}, sem::str(builtin), std::move(args));
    GlobalConst("C", expr);

    if (c.expected) {
        auto expected_case = c.expected.Get();

        ASSERT_TRUE(r()->Resolve()) << r()->error();

        auto* sem = Sem().Get(expr);
        ASSERT_NE(sem, nullptr);
        const sem::Constant* value = sem->ConstantValue();
        ASSERT_NE(value, nullptr);
        EXPECT_TYPE(value->Type(), sem->Type());

        if (value->Type()->Is<sem::Struct>()) {
            // The result type of the constant-evaluated expression is a structure.
            // Compare each of the fields individually.
            for (size_t i = 0; i < expected_case.values.Length(); i++) {
                CheckConstant(value->Index(i), ToValueBase(expected_case.values[i]),
                              expected_case.flags);
            }
        } else {
            // Return type is not a structure. Just compare the single value
            ASSERT_EQ(expected_case.values.Length(), 1u)
                << "const-eval returned non-struct, but Case expected multiple values";
            CheckConstant(value, ToValueBase(expected_case.values[0]), expected_case.flags);
        }
    } else {
        EXPECT_FALSE(r()->Resolve());
        EXPECT_EQ(r()->error(), c.expected.Failure().error);
    }
}

INSTANTIATE_TEST_SUITE_P(  //
    MixedAbstractArgs,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kAtan2),
                     testing::ValuesIn(std::vector{
                         C({0_a, -0.0_a}, kPi<AFloat>),
                         C({1.0_a, 0_a}, kPiOver2<AFloat>),
                     })));

template <typename T>
std::vector<Case> AbsCases() {
    std::vector<Case> cases = {
        C({T(0)}, T(0)),
        C({T(2.0)}, T(2.0)),
        C({T::Highest()}, T::Highest()),

        // Vector tests
        C({Vec(T(2.0), T::Highest())}, Vec(T(2.0), T::Highest())),
    };
    ConcatIntoIf<IsSignedIntegral<T>>(
        cases,
        std::vector<Case>{
            C({Negate(T(0))}, T(0)),
            C({Negate(T(2.0))}, T(2.0)),
            // If e is signed and is the largest negative, the result is e
            C({T::Lowest()}, T::Lowest()),

            // 1 more then min i32
            C({Negate(T(2147483647))}, T(2147483647)),

            C({Vec(T(0), Negate(T(0)))}, Vec(T(0), T(0))),
            C({Vec(Negate(T(2.0)), T(2.0), T::Highest())}, Vec(T(2.0), T(2.0), T::Highest())),
        });
    return cases;
}
INSTANTIATE_TEST_SUITE_P(  //
    Abs,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kAbs),
                     testing::ValuesIn(Concat(AbsCases<AInt>(),  //
                                              AbsCases<i32>(),
                                              AbsCases<u32>(),
                                              AbsCases<AFloat>(),
                                              AbsCases<f32>(),
                                              AbsCases<f16>()))));

static std::vector<Case> AllCases() {
    return {
        C({Val(true)}, Val(true)),
        C({Val(false)}, Val(false)),

        C({Vec(true, true)}, Val(true)),
        C({Vec(true, false)}, Val(false)),
        C({Vec(false, true)}, Val(false)),
        C({Vec(false, false)}, Val(false)),

        C({Vec(true, true, true)}, Val(true)),
        C({Vec(false, true, true)}, Val(false)),
        C({Vec(true, false, true)}, Val(false)),
        C({Vec(true, true, false)}, Val(false)),
        C({Vec(false, false, false)}, Val(false)),

        C({Vec(true, true, true, true)}, Val(true)),
        C({Vec(false, true, true, true)}, Val(false)),
        C({Vec(true, false, true, true)}, Val(false)),
        C({Vec(true, true, false, true)}, Val(false)),
        C({Vec(true, true, true, false)}, Val(false)),
        C({Vec(false, false, false, false)}, Val(false)),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    All,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kAll), testing::ValuesIn(AllCases())));

static std::vector<Case> AnyCases() {
    return {
        C({Val(true)}, Val(true)),
        C({Val(false)}, Val(false)),

        C({Vec(true, true)}, Val(true)),
        C({Vec(true, false)}, Val(true)),
        C({Vec(false, true)}, Val(true)),
        C({Vec(false, false)}, Val(false)),

        C({Vec(true, true, true)}, Val(true)),
        C({Vec(false, true, true)}, Val(true)),
        C({Vec(true, false, true)}, Val(true)),
        C({Vec(true, true, false)}, Val(true)),
        C({Vec(false, false, false)}, Val(false)),

        C({Vec(true, true, true, true)}, Val(true)),
        C({Vec(false, true, true, true)}, Val(true)),
        C({Vec(true, false, true, true)}, Val(true)),
        C({Vec(true, true, false, true)}, Val(true)),
        C({Vec(true, true, true, false)}, Val(true)),
        C({Vec(false, false, false, false)}, Val(false)),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Any,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kAny), testing::ValuesIn(AnyCases())));

template <typename T>
std::vector<Case> Atan2Cases() {
    return {
        // If y is +/-0 and x is negative or -0, +/-PI is returned
        C({T(0.0), -T(0.0)}, kPi<T>).PosOrNeg().FloatComp(),

        // If y is +/-0 and x is positive or +0, +/-0 is returned
        C({T(0.0), T(0.0)}, T(0.0)).PosOrNeg(),

        // If x is +/-0 and y is negative, -PI/2 is returned
        C({-T(1.0), T(0.0)}, -kPiOver2<T>).FloatComp(),  //
        C({-T(1.0), -T(0.0)}, -kPiOver2<T>).FloatComp(),

        // If x is +/-0 and y is positive, +PI/2 is returned
        C({T(1.0), T(0.0)}, kPiOver2<T>).FloatComp(),  //
        C({T(1.0), -T(0.0)}, kPiOver2<T>).FloatComp(),

        // Vector tests
        C({Vec(T(0.0), T(0.0)), Vec(-T(0.0), T(0.0))}, Vec(kPi<T>, T(0.0))).PosOrNeg().FloatComp(),
        C({Vec(-T(1.0), -T(1.0)), Vec(T(0.0), -T(0.0))}, Vec(-kPiOver2<T>, -kPiOver2<T>))
            .FloatComp(),
        C({Vec(T(1.0), T(1.0)), Vec(T(0.0), -T(0.0))}, Vec(kPiOver2<T>, kPiOver2<T>)).FloatComp(),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Atan2,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kAtan2),
                     testing::ValuesIn(Concat(Atan2Cases<AFloat>(),  //
                                              Atan2Cases<f32>(),
                                              Atan2Cases<f16>()))));

template <typename T>
std::vector<Case> AtanCases() {
    return {
        C({T(1.0)}, kPiOver4<T>).FloatComp(),
        C({-T(1.0)}, -kPiOver4<T>).FloatComp(),

        // If i is +/-0, +/-0 is returned
        C({T(0.0)}, T(0.0)).PosOrNeg(),

        // Vector tests
        C({Vec(T(0.0), T(1.0), -T(1.0))}, Vec(T(0.0), kPiOver4<T>, -kPiOver4<T>)).FloatComp(),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Atan,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kAtan),
                     testing::ValuesIn(Concat(AtanCases<AFloat>(),  //
                                              AtanCases<f32>(),
                                              AtanCases<f16>()))));

template <typename T>
std::vector<Case> AtanhCases() {
    return {
        // If i is +/-0, +/-0 is returned
        C({T(0.0)}, T(0.0)).PosOrNeg(),

        C({T(0.9)}, T(1.4722193)).FloatComp(),

        // Vector tests
        C({Vec(T(0.0), T(0.9), -T(0.9))}, Vec(T(0.0), T(1.4722193), -T(1.4722193))).FloatComp(),

        E({T(1.1)},
          "12:34 error: atanh must be called with a value in the range (-1 .. 1) (exclusive)"),
        E({-T(1.1)},
          "12:34 error: atanh must be called with a value in the range (-1 .. 1) (exclusive)"),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Atanh,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kAtanh),
                     testing::ValuesIn(Concat(AtanhCases<AFloat>(),  //
                                              AtanhCases<f32>(),
                                              AtanhCases<f16>()))));

template <typename T>
std::vector<Case> AcosCases() {
    return {
        // If i is +/-0, +/-0 is returned
        C({T(0.87758256189)}, T(0.5)).FloatComp(),

        C({T(1.0)}, T(0.0)),
        C({-T(1.0)}, kPi<T>).FloatComp(),

        // Vector tests
        C({Vec(T(1.0), -T(1.0))}, Vec(T(0), kPi<T>)).FloatComp(),

        E({T(1.1)},
          "12:34 error: acos must be called with a value in the range [-1 .. 1] (inclusive)"),
        E({-T(1.1)},
          "12:34 error: acos must be called with a value in the range [-1 .. 1] (inclusive)"),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Acos,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kAcos),
                     testing::ValuesIn(Concat(AcosCases<AFloat>(),  //
                                              AcosCases<f32>(),
                                              AcosCases<f16>()))));

template <typename T>
std::vector<Case> AcoshCases() {
    return {
        C({T(1.0)}, T(0.0)),
        C({T(11.5919532755)}, kPi<T>).FloatComp(),

        // Vector tests
        C({Vec(T(1.0), T(11.5919532755))}, Vec(T(0), kPi<T>)).FloatComp(),

        E({T::Smallest()}, "12:34 error: acosh must be called with a value >= 1.0"),
        E({-T(1.1)}, "12:34 error: acosh must be called with a value >= 1.0"),
        E({T(0)}, "12:34 error: acosh must be called with a value >= 1.0"),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Acosh,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kAcosh),
                     testing::ValuesIn(Concat(AcoshCases<AFloat>(),  //
                                              AcoshCases<f32>(),
                                              AcoshCases<f16>()))));

template <typename T>
std::vector<Case> AsinCases() {
    return {
        // If i is +/-0, +/-0 is returned
        C({T(0.0)}, T(0.0)),
        C({-T(0.0)}, -T(0.0)),

        C({T(1.0)}, kPiOver2<T>).FloatComp(),
        C({-T(1.0)}, -kPiOver2<T>).FloatComp(),

        // Vector tests
        C({Vec(T(0.0), T(1.0), -T(1.0))}, Vec(T(0.0), kPiOver2<T>, -kPiOver2<T>)).FloatComp(),

        E({T(1.1)},
          "12:34 error: asin must be called with a value in the range [-1 .. 1] (inclusive)"),
        E({-T(1.1)},
          "12:34 error: asin must be called with a value in the range [-1 .. 1] (inclusive)"),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Asin,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kAsin),
                     testing::ValuesIn(Concat(AsinCases<AFloat>(),  //
                                              AsinCases<f32>(),
                                              AsinCases<f16>()))));

template <typename T>
std::vector<Case> AsinhCases() {
    return {
        // If i is +/-0, +/-0 is returned
        C({T(0.0)}, T(0.0)),
        C({-T(0.0)}, -T(0.0)),

        C({T(0.9)}, T(0.80886693565278)).FloatComp(),
        C({-T(2.0)}, -T(1.4436354751788)).FloatComp(),

        // Vector tests
        C({Vec(T(0.0), T(0.9), -T(2.0))},  //
          Vec(T(0.0), T(0.8088669356278), -T(1.4436354751788)))
            .FloatComp(),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Asinh,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kAsinh),
                     testing::ValuesIn(Concat(AsinhCases<AFloat>(),  //
                                              AsinhCases<f32>(),
                                              AsinhCases<f16>()))));

template <typename T>
std::vector<Case> CeilCases() {
    return {
        C({T(0)}, T(0)),
        C({-T(0)}, -T(0)),
        C({-T(1.5)}, -T(1.0)),
        C({T(1.5)}, T(2.0)),
        C({T::Lowest()}, T::Lowest()),
        C({T::Highest()}, T::Highest()),

        C({Vec(T(0), T(1.5), -T(1.5))}, Vec(T(0), T(2.0), -T(1.0))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Ceil,
    ResolverConstEvalBuiltinTest,
    testing::Combine(
        testing::Values(sem::BuiltinType::kCeil),
        testing::ValuesIn(Concat(CeilCases<AFloat>(), CeilCases<f32>(), CeilCases<f16>()))));

template <typename T>
std::vector<Case> ClampCases() {
    return {
        C({T(0), T(0), T(0)}, T(0)),
        C({T(0), T(42), T::Highest()}, T(42)),
        C({T::Lowest(), T(0), T(42)}, T(0)),
        C({T(0), T::Lowest(), T::Highest()}, T(0)),
        C({T(0), T::Highest(), T::Lowest()}, T::Lowest()),
        C({T::Highest(), T::Highest(), T::Highest()}, T::Highest()),
        C({T::Lowest(), T::Lowest(), T::Lowest()}, T::Lowest()),
        C({T::Highest(), T::Lowest(), T::Highest()}, T::Highest()),
        C({T::Lowest(), T::Lowest(), T::Highest()}, T::Lowest()),

        // Vector tests
        C({Vec(T(0), T(0)),                         //
           Vec(T(0), T(42)),                        //
           Vec(T(0), T::Highest())},                //
          Vec(T(0), T(42))),                        //
        C({Vec(T::Lowest(), T(0), T(0)),            //
           Vec(T(0), T::Lowest(), T::Highest()),    //
           Vec(T(42), T::Highest(), T::Lowest())},  //
          Vec(T(0), T(0), T::Lowest())),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Clamp,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kClamp),
                     testing::ValuesIn(Concat(ClampCases<AInt>(),  //
                                              ClampCases<i32>(),
                                              ClampCases<u32>(),
                                              ClampCases<AFloat>(),
                                              ClampCases<f32>(),
                                              ClampCases<f16>()))));

template <typename T>
std::vector<Case> CosCases() {
    std::vector<Case> cases = {
        C({-T(0)}, T(1)),
        C({T(0)}, T(1)),

        C({T(0.75)}, T(0.7316888689)).FloatComp(),

        // Vector test
        C({Vec(T(0), -T(0), T(0.75))}, Vec(T(1), T(1), T(0.7316888689))).FloatComp(),
    };

    return cases;
}
INSTANTIATE_TEST_SUITE_P(  //
    Cos,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kCos),
                     testing::ValuesIn(Concat(CosCases<AFloat>(),  //
                                              CosCases<f32>(),
                                              CosCases<f16>()))));

template <typename T>
std::vector<Case> CoshCases() {
    auto error_msg = [](auto a) {
        return "12:34 error: " + OverflowErrorMessage(a, FriendlyName<decltype(a)>());
    };
    std::vector<Case> cases = {
        C({T(0)}, T(1)),
        C({-T(0)}, T(1)),
        C({T(1)}, T(1.5430806348)).FloatComp(),

        C({T(.75)}, T(1.2946832847)).FloatComp(),

        // Vector tests
        C({Vec(T(0), -T(0), T(1))}, Vec(T(1), T(1), T(1.5430806348))).FloatComp(),

        E({T(10000)}, error_msg(T::Inf())),
    };
    return cases;
}
INSTANTIATE_TEST_SUITE_P(  //
    Cosh,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kCosh),
                     testing::ValuesIn(Concat(CoshCases<AFloat>(),  //
                                              CoshCases<f32>(),
                                              CoshCases<f16>()))));

template <typename T>
std::vector<Case> CountLeadingZerosCases() {
    using B = BitValues<T>;
    return {
        C({B::Lsh(1, 31)}, T(0)),  //
        C({B::Lsh(1, 30)}, T(1)),  //
        C({B::Lsh(1, 29)}, T(2)),  //
        C({B::Lsh(1, 28)}, T(3)),
        //...
        C({B::Lsh(1, 3)}, T(28)),  //
        C({B::Lsh(1, 2)}, T(29)),  //
        C({B::Lsh(1, 1)}, T(30)),  //
        C({B::Lsh(1, 0)}, T(31)),

        C({T(0b1111'0000'1111'0000'1111'0000'1111'0000)}, T(0)),
        C({T(0b0111'1000'0111'1000'0111'1000'0111'1000)}, T(1)),
        C({T(0b0011'1100'0011'1100'0011'1100'0011'1100)}, T(2)),
        C({T(0b0001'1110'0001'1110'0001'1110'0001'1110)}, T(3)),
        //...
        C({T(0b0000'0000'0000'0000'0000'0000'0000'0111)}, T(29)),
        C({T(0b0000'0000'0000'0000'0000'0000'0000'0011)}, T(30)),
        C({T(0b0000'0000'0000'0000'0000'0000'0000'0001)}, T(31)),
        C({T(0b0000'0000'0000'0000'0000'0000'0000'0000)}, T(32)),

        // Same as above, but remove leading 0
        C({T(0b1111'1000'0111'1000'0111'1000'0111'1000)}, T(0)),
        C({T(0b1011'1100'0011'1100'0011'1100'0011'1100)}, T(0)),
        C({T(0b1001'1110'0001'1110'0001'1110'0001'1110)}, T(0)),
        //...
        C({T(0b1000'0000'0000'0000'0000'0000'0000'0111)}, T(0)),
        C({T(0b1000'0000'0000'0000'0000'0000'0000'0011)}, T(0)),
        C({T(0b1000'0000'0000'0000'0000'0000'0000'0001)}, T(0)),
        C({T(0b1000'0000'0000'0000'0000'0000'0000'0000)}, T(0)),

        // Vector tests
        C({Vec(B::Lsh(1, 31), B::Lsh(1, 30), B::Lsh(1, 29))}, Vec(T(0), T(1), T(2))),
        C({Vec(B::Lsh(1, 2), B::Lsh(1, 1), B::Lsh(1, 0))}, Vec(T(29), T(30), T(31))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    CountLeadingZeros,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kCountLeadingZeros),
                     testing::ValuesIn(Concat(CountLeadingZerosCases<i32>(),  //
                                              CountLeadingZerosCases<u32>()))));

template <typename T>
std::vector<Case> CountTrailingZerosCases() {
    using B = BitValues<T>;
    return {
        C({B::Lsh(1, 31)}, T(31)),  //
        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'1111'0000'1111'0000'1111'0000'1111)}, T(0)),
        C({T(0b0001'1110'0001'1110'0001'1110'0001'1110)}, T(1)),
        C({T(0b0011'1100'0011'1100'0011'1100'0011'1100)}, T(2)),
        C({T(0b0111'1000'0111'1000'0111'1000'0111'1000)}, T(3)),
        //...
        C({T(0b1110'0000'0000'0000'0000'0000'0000'0000)}, T(29)),
        C({T(0b1100'0000'0000'0000'0000'0000'0000'0000)}, T(30)),
        C({T(0b1000'0000'0000'0000'0000'0000'0000'0000)}, T(31)),
        C({T(0b0000'0000'0000'0000'0000'0000'0000'0000)}, T(32)),

        //// Same as above, but remove trailing 0
        C({T(0b0001'1110'0001'1110'0001'1110'0001'1111)}, T(0)),
        C({T(0b0011'1100'0011'1100'0011'1100'0011'1101)}, T(0)),
        C({T(0b0111'1000'0111'1000'0111'1000'0111'1001)}, T(0)),
        //...
        C({T(0b1110'0000'0000'0000'0000'0000'0000'0001)}, T(0)),
        C({T(0b1100'0000'0000'0000'0000'0000'0000'0001)}, T(0)),
        C({T(0b1000'0000'0000'0000'0000'0000'0000'0001)}, T(0)),
        C({T(0b0000'0000'0000'0000'0000'0000'0000'0001)}, T(0)),

        // Vector tests
        C({Vec(B::Lsh(1, 31), B::Lsh(1, 30), B::Lsh(1, 29))}, Vec(T(31), T(30), T(29))),
        C({Vec(B::Lsh(1, 2), B::Lsh(1, 1), B::Lsh(1, 0))}, Vec(T(2), T(1), T(0))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    CountTrailingZeros,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kCountTrailingZeros),
                     testing::ValuesIn(Concat(CountTrailingZerosCases<i32>(),  //
                                              CountTrailingZerosCases<u32>()))));

template <typename T>
std::vector<Case> CountOneBitsCases() {
    using B = BitValues<T>;
    return {
        C({T(0)}, T(0)),  //

        C({B::Lsh(1, 31)}, T(1)),  //
        C({B::Lsh(1, 30)}, T(1)),  //
        C({B::Lsh(1, 29)}, T(1)),  //
        C({B::Lsh(1, 28)}, T(1)),
        //...
        C({B::Lsh(1, 3)}, T(1)),  //
        C({B::Lsh(1, 2)}, T(1)),  //
        C({B::Lsh(1, 1)}, T(1)),  //
        C({B::Lsh(1, 0)}, T(1)),

        C({T(0b1010'1010'1010'1010'1010'1010'1010'1010)}, T(16)),
        C({T(0b0000'1111'0000'1111'0000'1111'0000'1111)}, T(16)),
        C({T(0b0101'0000'0000'0000'0000'0000'0000'0101)}, T(4)),

        // Vector tests
        C({Vec(B::Lsh(1, 31), B::Lsh(1, 30), B::Lsh(1, 29))}, Vec(T(1), T(1), T(1))),
        C({Vec(B::Lsh(1, 2), B::Lsh(1, 1), B::Lsh(1, 0))}, Vec(T(1), T(1), T(1))),

        C({Vec(T(0b1010'1010'1010'1010'1010'1010'1010'1010),
               T(0b0000'1111'0000'1111'0000'1111'0000'1111),
               T(0b0101'0000'0000'0000'0000'0000'0000'0101))},
          Vec(T(16), T(16), T(4))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    CountOneBits,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kCountOneBits),
                     testing::ValuesIn(Concat(CountOneBitsCases<i32>(),  //
                                              CountOneBitsCases<u32>()))));

template <typename T>
std::vector<Case> CrossCases() {
    constexpr auto vec_x = [](T v) { return Vec(T(v), T(0), T(0)); };
    constexpr auto vec_y = [](T v) { return Vec(T(0), T(v), T(0)); };
    constexpr auto vec_z = [](T v) { return Vec(T(0), T(0), T(v)); };

    const auto zero = Vec(T(0), T(0), T(0));
    const auto unit_x = vec_x(T(1));
    const auto unit_y = vec_y(T(1));
    const auto unit_z = vec_z(T(1));
    const auto neg_unit_x = vec_x(-T(1));
    const auto neg_unit_y = vec_y(-T(1));
    const auto neg_unit_z = vec_z(-T(1));
    const auto highest_x = vec_x(T::Highest());
    const auto highest_y = vec_y(T::Highest());
    const auto highest_z = vec_z(T::Highest());
    const auto smallest_x = vec_x(T::Smallest());
    const auto smallest_y = vec_y(T::Smallest());
    const auto smallest_z = vec_z(T::Smallest());
    const auto lowest_x = vec_x(T::Lowest());
    const auto lowest_y = vec_y(T::Lowest());
    const auto lowest_z = vec_z(T::Lowest());

    std::vector<Case> r = {
        C({zero, zero}, zero),

        C({unit_x, unit_x}, zero),
        C({unit_y, unit_y}, zero),
        C({unit_z, unit_z}, zero),

        C({smallest_x, smallest_x}, zero),
        C({smallest_y, smallest_y}, zero),
        C({smallest_z, smallest_z}, zero),

        C({lowest_x, lowest_x}, zero),
        C({lowest_y, lowest_y}, zero),
        C({lowest_z, lowest_z}, zero),

        C({highest_x, highest_x}, zero),
        C({highest_y, highest_y}, zero),
        C({highest_z, highest_z}, zero),

        C({smallest_x, highest_x}, zero),
        C({smallest_y, highest_y}, zero),
        C({smallest_z, highest_z}, zero),

        C({unit_x, neg_unit_x}, zero).PosOrNeg(),
        C({unit_y, neg_unit_y}, zero).PosOrNeg(),
        C({unit_z, neg_unit_z}, zero).PosOrNeg(),

        C({unit_x, unit_y}, unit_z),
        C({unit_y, unit_x}, neg_unit_z),

        C({unit_z, unit_x}, unit_y),
        C({unit_x, unit_z}, neg_unit_y),

        C({unit_y, unit_z}, unit_x),
        C({unit_z, unit_y}, neg_unit_x),

        C({vec_x(T(1)), vec_y(T(2))}, vec_z(T(2))),
        C({vec_y(T(1)), vec_x(T(2))}, vec_z(-T(2))),
        C({vec_x(T(2)), vec_y(T(3))}, vec_z(T(6))),
        C({vec_y(T(2)), vec_x(T(3))}, vec_z(-T(6))),

        C({Vec(T(1), T(2), T(3)), Vec(T(1), T(5), T(7))}, Vec(T(-1), T(-4), T(3))),
        C({Vec(T(33), T(44), T(55)), Vec(T(13), T(42), T(39))}, Vec(T(-594), T(-572), T(814))),
        C({Vec(T(3.5), T(4), T(5.5)), Vec(T(1), T(4.5), T(3.5))},
          Vec(T(-10.75), T(-6.75), T(11.75))),
    };

    std::string pos_error_msg =
        "12:34 error: " + OverflowErrorMessage(T::Highest(), "*", T::Highest());
    std::string neg_error_msg =
        "12:34 error: " + OverflowErrorMessage(T::Lowest(), "*", T::Lowest());
    ConcatInto(  //
        r, std::vector<Case>{
               E({highest_x, highest_y}, pos_error_msg),
               E({highest_y, highest_x}, pos_error_msg),
               E({highest_z, highest_x}, pos_error_msg),
               E({highest_x, highest_z}, pos_error_msg),
               E({highest_y, highest_z}, pos_error_msg),
               E({highest_z, highest_y}, pos_error_msg),
               E({lowest_x, lowest_y}, neg_error_msg),
               E({lowest_y, lowest_x}, neg_error_msg),
               E({lowest_z, lowest_x}, neg_error_msg),
               E({lowest_x, lowest_z}, neg_error_msg),
               E({lowest_y, lowest_z}, neg_error_msg),
               E({lowest_z, lowest_y}, neg_error_msg),
           });

    return r;
}
INSTANTIATE_TEST_SUITE_P(  //
    Cross,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kCross),
                     testing::ValuesIn(Concat(CrossCases<AFloat>(),  //
                                              CrossCases<f32>(),     //
                                              CrossCases<f16>()))));

template <typename T>
std::vector<Case> DotCases() {
    auto r = std::vector<Case>{
        C({Vec(T(0), T(0)), Vec(T(0), T(0))}, Val(T(0))),
        C({Vec(T(0), T(0), T(0)), Vec(T(0), T(0), T(0))}, Val(T(0))),
        C({Vec(T(0), T(0), T(0), T(0)), Vec(T(0), T(0), T(0), T(0))}, Val(T(0))),
        C({Vec(T(1), T(2), T(3), T(4)), Vec(T(5), T(6), T(7), T(8))}, Val(T(70))),

        C({Vec(T(1), T(1)), Vec(T(1), T(1))}, Val(T(2))),
        C({Vec(T(1), T(2)), Vec(T(2), T(1))}, Val(T(4))),
        C({Vec(T(2), T(2)), Vec(T(2), T(2))}, Val(T(8))),

        C({Vec(T::Highest(), T::Highest()), Vec(T(1), T(0))}, Val(T::Highest())),
        C({Vec(T::Lowest(), T::Lowest()), Vec(T(1), T(0))}, Val(T::Lowest())),
    };

    if constexpr (IsAbstract<T> || IsFloatingPoint<T>) {
        auto error_msg = [](auto a, const char* op, auto b) {
            return "12:34 error: " + OverflowErrorMessage(a, op, b) + R"(
12:34 note: when calculating dot)";
        };
        ConcatInto(  //
            r, std::vector<Case>{
                   E({Vec(T::Highest(), T::Highest()), Vec(T(1), T(1))},
                     error_msg(T::Highest(), "+", T::Highest())),
                   E({Vec(T::Lowest(), T::Lowest()), Vec(T(1), T(1))},
                     error_msg(T::Lowest(), "+", T::Lowest())),
               });
    } else {
        // Overflow is not an error for concrete integrals
        ConcatInto(  //
            r, std::vector<Case>{
                   C({Vec(T::Highest(), T::Highest()), Vec(T(1), T(1))},
                     Val(Add(T::Highest(), T::Highest()))),
                   C({Vec(T::Lowest(), T::Lowest()), Vec(T(1), T(1))},
                     Val(Add(T::Lowest(), T::Lowest()))),
               });
    }
    return r;
}
INSTANTIATE_TEST_SUITE_P(  //
    Dot,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kDot),
                     testing::ValuesIn(Concat(DotCases<AInt>(),    //
                                              DotCases<i32>(),     //
                                              DotCases<u32>(),     //
                                              DotCases<AFloat>(),  //
                                              DotCases<f32>(),     //
                                              DotCases<f16>()))));

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> FirstTrailingBitCases() {
    using B = BitValues<T>;
    auto r = std::vector<Case>{
        C({T(0)}, T(-1)),

        C({B::Lsh(1, 31)}, T(31)),  //
        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(11)),
        C({T(0b0000'0100'1000'1000'1000'0000'0000'0000)}, T(15)),

        // Vector tests
        C({Vec(B::Lsh(1, 31), B::Lsh(1, 30), B::Lsh(1, 29))}, Vec(T(31), T(30), T(29))),
        C({Vec(B::Lsh(1, 2), B::Lsh(1, 1), B::Lsh(1, 0))}, Vec(T(2), T(1), T(0))),
    };

    return r;
}
INSTANTIATE_TEST_SUITE_P(  //
    FirstTrailingBit,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kFirstTrailingBit),
                     testing::ValuesIn(Concat(FirstTrailingBitCases<i32>(),  //
                                              FirstTrailingBitCases<u32>()))));

template <typename T>
std::vector<Case> FloorCases() {
    return {
        C({T(0)}, T(0)),
        C({-T(0)}, -T(0)),
        C({-T(1.5)}, -T(2.0)),
        C({T(1.5)}, T(1.0)),
        C({T::Lowest()}, T::Lowest()),
        C({T::Highest()}, T::Highest()),

        C({Vec(T(0), T(1.5), -T(1.5))}, Vec(T(0), T(1.0), -T(2.0))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Floor,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kFloor),
                     testing::ValuesIn(Concat(FloorCases<AFloat>(),  //
                                              FloorCases<f32>(),
                                              FloorCases<f16>()))));

template <typename T>
std::vector<Case> InsertBitsCases() {
    using UT = Number<std::make_unsigned_t<UnwrapNumber<T>>>;

    auto e = /* */ T(0b0101'1100'0011'1010'0101'1100'0011'1010);
    auto newbits = T{0b1010'0011'1100'0101'1010'0011'1100'0101};

    auto r = std::vector<Case>{
        // args: e, newbits, offset, count

        // If count is 0, result is e
        C({e, newbits, UT(0), UT(0)}, e),  //
        C({e, newbits, UT(1), UT(0)}, e),  //
        C({e, newbits, UT(2), UT(0)}, e),  //
        C({e, newbits, UT(3), UT(0)}, e),  //
        // ...
        C({e, newbits, UT(29), UT(0)}, e),  //
        C({e, newbits, UT(30), UT(0)}, e),  //
        C({e, newbits, UT(31), UT(0)}, e),

        // Copy 1 to 32 bits of newbits to e at offset 0
        C({e, newbits, UT(0), UT(1)}, T(0b0101'1100'0011'1010'0101'1100'0011'1011)),
        C({e, newbits, UT(0), UT(2)}, T(0b0101'1100'0011'1010'0101'1100'0011'1001)),
        C({e, newbits, UT(0), UT(3)}, T(0b0101'1100'0011'1010'0101'1100'0011'1101)),
        C({e, newbits, UT(0), UT(4)}, T(0b0101'1100'0011'1010'0101'1100'0011'0101)),
        C({e, newbits, UT(0), UT(5)}, T(0b0101'1100'0011'1010'0101'1100'0010'0101)),
        C({e, newbits, UT(0), UT(6)}, T(0b0101'1100'0011'1010'0101'1100'0000'0101)),
        // ...
        C({e, newbits, UT(0), UT(29)}, T(0b0100'0011'1100'0101'1010'0011'1100'0101)),
        C({e, newbits, UT(0), UT(30)}, T(0b0110'0011'1100'0101'1010'0011'1100'0101)),
        C({e, newbits, UT(0), UT(31)}, T(0b0010'0011'1100'0101'1010'0011'1100'0101)),
        C({e, newbits, UT(0), UT(32)}, T(0b1010'0011'1100'0101'1010'0011'1100'0101)),

        // Copy at varying offsets and counts
        C({e, newbits, UT(3), UT(8)}, T(0b0101'1100'0011'1010'0101'1110'0010'1010)),
        C({e, newbits, UT(8), UT(8)}, T(0b0101'1100'0011'1010'1100'0101'0011'1010)),
        C({e, newbits, UT(15), UT(1)}, T(0b0101'1100'0011'1010'1101'1100'0011'1010)),
        C({e, newbits, UT(16), UT(16)}, T(0b1010'0011'1100'0101'0101'1100'0011'1010)),

        // Vector tests
        C({Vec(T(0b1111'0000'1111'0000'1111'0000'1111'0000),  //
               T(0b0000'1111'0000'1111'0000'1111'0000'1111),  //
               T(0b1010'0101'1010'0101'1010'0101'1010'0101)),
           Vec(T(0b1111'1111'1111'1111'1111'1111'1111'1111),  //
               T(0b1111'1111'1111'1111'1111'1111'1111'1111),  //
               T(0b1111'1111'1111'1111'1111'1111'1111'1111)),
           Val(UT(3)), Val(UT(8))},
          Vec(T(0b1111'0000'1111'0000'1111'0111'1111'1000),  //
              T(0b0000'1111'0000'1111'0000'1111'1111'1111),  //
              T(0b1010'0101'1010'0101'1010'0111'1111'1101))),
    };

    const char* error_msg =
        "12:34 error: 'offset + 'count' must be less than or equal to the bit width of 'e'";
    ConcatInto(  //
        r, std::vector<Case>{
               E({T(1), T(1), UT(33), UT(0)}, error_msg),         //
               E({T(1), T(1), UT(34), UT(0)}, error_msg),         //
               E({T(1), T(1), UT(1000), UT(0)}, error_msg),       //
               E({T(1), T(1), UT::Highest(), UT()}, error_msg),   //
               E({T(1), T(1), UT(0), UT(33)}, error_msg),         //
               E({T(1), T(1), UT(0), UT(34)}, error_msg),         //
               E({T(1), T(1), UT(0), UT(1000)}, error_msg),       //
               E({T(1), T(1), UT(0), UT::Highest()}, error_msg),  //
               E({T(1), T(1), UT(33), UT(33)}, error_msg),        //
               E({T(1), T(1), UT(34), UT(34)}, error_msg),        //
               E({T(1), T(1), UT(1000), UT(1000)}, error_msg),    //
               E({T(1), T(1), UT::Highest(), UT(1)}, error_msg),
               E({T(1), T(1), UT(1), UT::Highest()}, error_msg),
               E({T(1), T(1), UT::Highest(), u32::Highest()}, error_msg),
           });

    return r;
}
INSTANTIATE_TEST_SUITE_P(  //
    InsertBits,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kInsertBits),
                     testing::ValuesIn(Concat(InsertBitsCases<i32>(),  //
                                              InsertBitsCases<u32>()))));

template <typename T>
std::vector<Case> DegreesAFloatCases() {
    return std::vector<Case>{
        C({T(0)}, T(0)),                             //
        C({-T(0)}, -T(0)),                           //
        C({T(0.698132)}, T(40)).FloatComp(),         //
        C({-T(1.5708)}, -T(90.000214)).FloatComp(),  //
        C({T(1.5708)}, T(90.000214)).FloatComp(),    //
        C({T(6.28319)}, T(360.00027)).FloatComp(),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    DegreesAFloat,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kDegrees),
                     testing::ValuesIn(DegreesAFloatCases<AFloat>())));

template <typename T>
std::vector<Case> DegreesF32Cases() {
    return std::vector<Case>{
        C({T(0)}, T(0)),                             //
        C({-T(0)}, -T(0)),                           //
        C({T(0.698132)}, T(40)).FloatComp(),         //
        C({-T(1.5708)}, -T(90.000206)).FloatComp(),  //
        C({T(1.5708)}, T(90.000206)).FloatComp(),    //
        C({T(6.28319)}, T(360.00024)).FloatComp(),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    DegreesF32,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kDegrees),
                     testing::ValuesIn(DegreesF32Cases<f32>())));

template <typename T>
std::vector<Case> DegreesF16Cases() {
    return std::vector<Case>{
        C({T(0)}, T(0)),                            //
        C({-T(0)}, -T(0)),                          //
        C({T(0.698132)}, T(39.96875)).FloatComp(),  //
        C({-T(1.5708)}, -T(89.9375)).FloatComp(),   //
        C({T(1.5708)}, T(89.9375)).FloatComp(),     //
        C({T(6.28319)}, T(359.75)).FloatComp(),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    DegreesF16,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kDegrees),
                     testing::ValuesIn(DegreesF16Cases<f16>())));

template <typename T>
std::vector<Case> ExtractBitsCases() {
    using UT = Number<std::make_unsigned_t<UnwrapNumber<T>>>;

    // If T is signed, fills most significant bits of `val` with 1s
    auto set_msbs_if_signed = [](T val) {
        if constexpr (IsSignedIntegral<T>) {
            T result = T(~0);
            for (size_t b = 0; val; ++b) {
                if ((val & 1) == 0) {
                    result = result & ~(1 << b);  // Clear bit b
                }
                val = val >> 1;
            }
            return result;
        } else {
            return val;
        }
    };

    auto e = T(0b10100011110001011010001111000101);
    auto f = T(0b01010101010101010101010101010101);
    auto g = T(0b11111010001111000101101000111100);

    auto r = std::vector<Case>{
        // args: e, offset, count

        // If count is 0, result is 0
        C({e, UT(0), UT(0)}, T(0)),  //
        C({e, UT(1), UT(0)}, T(0)),  //
        C({e, UT(2), UT(0)}, T(0)),  //
        C({e, UT(3), UT(0)}, T(0)),
        // ...
        C({e, UT(29), UT(0)}, T(0)),  //
        C({e, UT(30), UT(0)}, T(0)),  //
        C({e, UT(31), UT(0)}, T(0)),

        // Extract at offset 0, varying counts
        C({e, UT(0), UT(1)}, set_msbs_if_signed(T(0b1))),    //
        C({e, UT(0), UT(2)}, T(0b01)),                       //
        C({e, UT(0), UT(3)}, set_msbs_if_signed(T(0b101))),  //
        C({e, UT(0), UT(4)}, T(0b0101)),                     //
        C({e, UT(0), UT(5)}, T(0b00101)),                    //
        C({e, UT(0), UT(6)}, T(0b000101)),                   //
        // ...
        C({e, UT(0), UT(28)}, T(0b0011110001011010001111000101)),                        //
        C({e, UT(0), UT(29)}, T(0b00011110001011010001111000101)),                       //
        C({e, UT(0), UT(30)}, set_msbs_if_signed(T(0b100011110001011010001111000101))),  //
        C({e, UT(0), UT(31)}, T(0b0100011110001011010001111000101)),                     //
        C({e, UT(0), UT(32)}, T(0b10100011110001011010001111000101)),                    //

        // Extract at varying offsets and counts
        C({e, UT(0), UT(1)}, set_msbs_if_signed(T(0b1))),                   //
        C({e, UT(31), UT(1)}, set_msbs_if_signed(T(0b1))),                  //
        C({e, UT(3), UT(5)}, set_msbs_if_signed(T(0b11000))),               //
        C({e, UT(4), UT(7)}, T(0b0111100)),                                 //
        C({e, UT(10), UT(16)}, set_msbs_if_signed(T(0b1111000101101000))),  //
        C({e, UT(10), UT(22)}, set_msbs_if_signed(T(0b1010001111000101101000))),

        // Vector tests
        C({Vec(e, f, g),                          //
           Val(UT(5)), Val(UT(8))},               //
          Vec(T(0b00011110),                      //
              set_msbs_if_signed(T(0b10101010)),  //
              set_msbs_if_signed(T(0b11010001)))),
    };

    const char* error_msg =
        "12:34 error: 'offset + 'count' must be less than or equal to the bit width of 'e'";
    ConcatInto(  //
        r, std::vector<Case>{
               E({T(1), UT(33), UT(0)}, error_msg),
               E({T(1), UT(34), UT(0)}, error_msg),
               E({T(1), UT(1000), UT(0)}, error_msg),
               E({T(1), UT::Highest(), UT(0)}, error_msg),
               E({T(1), UT(0), UT(33)}, error_msg),
               E({T(1), UT(0), UT(34)}, error_msg),
               E({T(1), UT(0), UT(1000)}, error_msg),
               E({T(1), UT(0), UT::Highest()}, error_msg),
               E({T(1), UT(33), UT(33)}, error_msg),
               E({T(1), UT(34), UT(34)}, error_msg),
               E({T(1), UT(1000), UT(1000)}, error_msg),
               E({T(1), UT::Highest(), UT(1)}, error_msg),
               E({T(1), UT(1), UT::Highest()}, error_msg),
               E({T(1), UT::Highest(), UT::Highest()}, error_msg),
           });

    return r;
}
INSTANTIATE_TEST_SUITE_P(  //
    ExtractBits,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kExtractBits),
                     testing::ValuesIn(Concat(ExtractBitsCases<i32>(),  //
                                              ExtractBitsCases<u32>()))));

template <typename T>
std::vector<Case> LengthCases() {
    const auto kSqrtOfHighest = T(std::sqrt(T::Highest()));
    const auto kSqrtOfHighestSquared = T(kSqrtOfHighest * kSqrtOfHighest);

    auto error_msg = [](auto a, const char* op, auto b) {
        return "12:34 error: " + OverflowErrorMessage(a, op, b) + R"(
12:34 note: when calculating length)";
    };
    return {
        C({T(0)}, T(0)),
        C({Vec(T(0), T(0))}, Val(T(0))),
        C({Vec(T(0), T(0), T(0))}, Val(T(0))),
        C({Vec(T(0), T(0), T(0), T(0))}, Val(T(0))),

        C({T(1)}, T(1)),
        C({Vec(T(1), T(1))}, Val(T(std::sqrt(2)))),
        C({Vec(T(1), T(1), T(1))}, Val(T(std::sqrt(3)))),
        C({Vec(T(1), T(1), T(1), T(1))}, Val(T(std::sqrt(4)))),

        C({T(2)}, T(2)),
        C({Vec(T(2), T(2))}, Val(T(std::sqrt(8)))),
        C({Vec(T(2), T(2), T(2))}, Val(T(std::sqrt(12)))),
        C({Vec(T(2), T(2), T(2), T(2))}, Val(T(std::sqrt(16)))),

        C({Vec(T(2), T(3))}, Val(T(std::sqrt(13)))),
        C({Vec(T(2), T(3), T(4))}, Val(T(std::sqrt(29)))),
        C({Vec(T(2), T(3), T(4), T(5))}, Val(T(std::sqrt(54)))),

        C({T(-5)}, T(5)),
        C({T::Highest()}, T::Highest()),
        C({T::Lowest()}, T::Highest()),

        C({Vec(T(-2), T(-3), T(-4), T(-5))}, Val(T(std::sqrt(54)))),
        C({Vec(T(2), T(-3), T(4), T(-5))}, Val(T(std::sqrt(54)))),
        C({Vec(T(-2), T(3), T(-4), T(5))}, Val(T(std::sqrt(54)))),

        C({Vec(kSqrtOfHighest, T(0))}, Val(kSqrtOfHighest)).FloatComp(0.2),
        C({Vec(T(0), kSqrtOfHighest)}, Val(kSqrtOfHighest)).FloatComp(0.2),

        C({Vec(-kSqrtOfHighest, T(0))}, Val(kSqrtOfHighest)).FloatComp(0.2),
        C({Vec(T(0), -kSqrtOfHighest)}, Val(kSqrtOfHighest)).FloatComp(0.2),

        // Overflow when squaring a term
        E({Vec(T::Highest(), T(0))}, error_msg(T::Highest(), "*", T::Highest())),
        E({Vec(T(0), T::Highest())}, error_msg(T::Highest(), "*", T::Highest())),
        // Overflow when adding squared terms
        E({Vec(kSqrtOfHighest, kSqrtOfHighest)},
          error_msg(kSqrtOfHighestSquared, "+", kSqrtOfHighestSquared)),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Length,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kLength),
                     testing::ValuesIn(Concat(LengthCases<AFloat>(),  //
                                              LengthCases<f32>(),
                                              LengthCases<f16>()))));

template <typename T>
std::vector<Case> MaxCases() {
    return {
        C({T(0), T(0)}, T(0)),
        C({T(0), T::Highest()}, T::Highest()),
        C({T::Lowest(), T(0)}, T(0)),
        C({T::Highest(), T::Lowest()}, T::Highest()),
        C({T::Highest(), T::Highest()}, T::Highest()),
        C({T::Lowest(), T::Lowest()}, T::Lowest()),

        // Vector tests
        C({Vec(T(0), T(0)), Vec(T(0), T(42))}, Vec(T(0), T(42))),
        C({Vec(T::Lowest(), T(0)), Vec(T(0), T::Lowest())}, Vec(T(0), T(0))),
        C({Vec(T::Lowest(), T::Highest()), Vec(T::Highest(), T::Lowest())},
          Vec(T::Highest(), T::Highest())),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Max,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kMax),
                     testing::ValuesIn(Concat(MaxCases<AInt>(),  //
                                              MaxCases<i32>(),
                                              MaxCases<u32>(),
                                              MaxCases<AFloat>(),
                                              MaxCases<f32>(),
                                              MaxCases<f16>()))));

template <typename T>
std::vector<Case> MinCases() {
    return {C({T(0), T(0)}, T(0)),                //
            C({T(0), T(42)}, T(0)),               //
            C({T::Lowest(), T(0)}, T::Lowest()),  //
            C({T(0), T::Highest()}, T(0)),        //
            C({T::Highest(), T::Lowest()}, T::Lowest()),
            C({T::Highest(), T::Highest()}, T::Highest()),
            C({T::Lowest(), T::Lowest()}, T::Lowest()),

            // Vector tests
            C({Vec(T(0), T(0)), Vec(T(0), T(42))}, Vec(T(0), T(0))),
            C({Vec(T::Lowest(), T(0), T(1)), Vec(T(0), T(42), T::Highest())},
              Vec(T::Lowest(), T(0), T(1)))};
}
INSTANTIATE_TEST_SUITE_P(  //
    Min,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kMin),
                     testing::ValuesIn(Concat(MinCases<AInt>(),  //
                                              MinCases<i32>(),
                                              MinCases<u32>(),
                                              MinCases<AFloat>(),
                                              MinCases<f32>(),
                                              MinCases<f16>()))));
template <typename T>
std::vector<Case> ModfCases() {
    return {
        // Scalar tests
        //  in     fract    whole
        C({T(0.0)}, {T(0.0), T(0.0)}),              //
        C({T(1.0)}, {T(0.0), T(1.0)}),              //
        C({T(2.0)}, {T(0.0), T(2.0)}),              //
        C({T(1.5)}, {T(0.5), T(1.0)}),              //
        C({T(4.25)}, {T(0.25), T(4.0)}),            //
        C({T(-1.0)}, {T(0.0), T(-1.0)}),            //
        C({T(-2.0)}, {T(0.0), T(-2.0)}),            //
        C({T(-1.5)}, {T(-0.5), T(-1.0)}),           //
        C({T(-4.25)}, {T(-0.25), T(-4.0)}),         //
        C({T::Lowest()}, {T(0.0), T::Lowest()}),    //
        C({T::Highest()}, {T(0.0), T::Highest()}),  //

        // Vector tests
        //         in                 fract                    whole
        C({Vec(T(0.0), T(0.0))}, {Vec(T(0.0), T(0.0)), Vec(T(0.0), T(0.0))}),
        C({Vec(T(1.0), T(2.0))}, {Vec(T(0.0), T(0.0)), Vec(T(1), T(2))}),
        C({Vec(T(-2.0), T(1.0))}, {Vec(T(0.0), T(0.0)), Vec(T(-2), T(1))}),
        C({Vec(T(1.5), T(-2.25))}, {Vec(T(0.5), T(-0.25)), Vec(T(1.0), T(-2.0))}),
        C({Vec(T::Lowest(), T::Highest())}, {Vec(T(0.0), T(0.0)), Vec(T::Lowest(), T::Highest())}),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Modf,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kModf),
                     testing::ValuesIn(Concat(ModfCases<f32>(),  //
                                              ModfCases<f16>()))));

std::vector<Case> Pack4x8snormCases() {
    return {
        C({Vec(f32(0), f32(0), f32(0), f32(0))}, Val(u32(0x0000'0000))),
        C({Vec(f32(0), f32(0), f32(0), f32(-1))}, Val(u32(0x8100'0000))),
        C({Vec(f32(0), f32(0), f32(0), f32(1))}, Val(u32(0x7f00'0000))),
        C({Vec(f32(0), f32(0), f32(-1), f32(0))}, Val(u32(0x0081'0000))),
        C({Vec(f32(0), f32(1), f32(0), f32(0))}, Val(u32(0x0000'7f00))),
        C({Vec(f32(-1), f32(0), f32(0), f32(0))}, Val(u32(0x0000'0081))),
        C({Vec(f32(1), f32(-1), f32(1), f32(-1))}, Val(u32(0x817f'817f))),
        C({Vec(f32::Highest(), f32(-0.5), f32(0.5), f32::Lowest())}, Val(u32(0x8140'c17f))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Pack4x8snorm,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kPack4X8Snorm),
                     testing::ValuesIn(Pack4x8snormCases())));

std::vector<Case> Pack4x8unormCases() {
    return {
        C({Vec(f32(0), f32(0), f32(0), f32(0))}, Val(u32(0x0000'0000))),
        C({Vec(f32(0), f32(0), f32(0), f32(1))}, Val(u32(0xff00'0000))),
        C({Vec(f32(0), f32(0), f32(1), f32(0))}, Val(u32(0x00ff'0000))),
        C({Vec(f32(0), f32(1), f32(0), f32(0))}, Val(u32(0x0000'ff00))),
        C({Vec(f32(1), f32(0), f32(0), f32(0))}, Val(u32(0x0000'00ff))),
        C({Vec(f32(1), f32(0), f32(1), f32(0))}, Val(u32(0x00ff'00ff))),
        C({Vec(f32::Highest(), f32(0), f32(0.5), f32::Lowest())}, Val(u32(0x0080'00ff))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Pack4x8unorm,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kPack4X8Unorm),
                     testing::ValuesIn(Pack4x8unormCases())));

std::vector<Case> Pack2x16floatCases() {
    return {
        C({Vec(f32(f16::Lowest()), f32(f16::Highest()))}, Val(u32(0x7bff'fbff))),
        C({Vec(f32(1), f32(-1))}, Val(u32(0xbc00'3c00))),
        C({Vec(f32(0), f32(0))}, Val(u32(0x0000'0000))),
        C({Vec(f32(10), f32(-10.5))}, Val(u32(0xc940'4900))),

        E({Vec(f32(0), f32::Highest())},
          "12:34 error: value 3.4028234663852885981e+38 cannot be represented as 'f16'"),
        E({Vec(f32::Lowest(), f32(0))},
          "12:34 error: value -3.4028234663852885981e+38 cannot be represented as 'f16'"),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Pack2x16float,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kPack2X16Float),
                     testing::ValuesIn(Pack2x16floatCases())));

std::vector<Case> Pack2x16snormCases() {
    return {
        C({Vec(f32(0), f32(0))}, Val(u32(0x0000'0000))),
        C({Vec(f32(0), f32(-1))}, Val(u32(0x8001'0000))),
        C({Vec(f32(0), f32(1))}, Val(u32(0x7fff'0000))),
        C({Vec(f32(-1), f32(0))}, Val(u32(0x0000'8001))),
        C({Vec(f32(1), f32(0))}, Val(u32(0x0000'7fff))),
        C({Vec(f32(1), f32(-1))}, Val(u32(0x8001'7fff))),
        C({Vec(f32::Highest(), f32::Lowest())}, Val(u32(0x8001'7fff))),
        C({Vec(f32(-0.5), f32(0.5))}, Val(u32(0x4000'c001))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Pack2x16snorm,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kPack2X16Snorm),
                     testing::ValuesIn(Pack2x16snormCases())));

std::vector<Case> Pack2x16unormCases() {
    return {
        C({Vec(f32(0), f32(1))}, Val(u32(0xffff'0000))),
        C({Vec(f32(1), f32(0))}, Val(u32(0x0000'ffff))),
        C({Vec(f32(0.5), f32(0))}, Val(u32(0x0000'8000))),
        C({Vec(f32::Highest(), f32::Lowest())}, Val(u32(0x0000'ffff))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Pack2x16unorm,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kPack2X16Unorm),
                     testing::ValuesIn(Pack2x16unormCases())));

template <typename T>
std::vector<Case> ReverseBitsCases() {
    using B = BitValues<T>;
    return {
        C({T(0)}, T(0)),

        C({B::Lsh(1, 0)}, B::Lsh(1, 31)),  //
        C({B::Lsh(1, 1)}, B::Lsh(1, 30)),  //
        C({B::Lsh(1, 2)}, B::Lsh(1, 29)),  //
        C({B::Lsh(1, 3)}, B::Lsh(1, 28)),  //
        C({B::Lsh(1, 4)}, B::Lsh(1, 27)),  //
        //...
        C({B::Lsh(1, 27)}, B::Lsh(1, 4)),  //
        C({B::Lsh(1, 28)}, B::Lsh(1, 3)),  //
        C({B::Lsh(1, 29)}, B::Lsh(1, 2)),  //
        C({B::Lsh(1, 30)}, B::Lsh(1, 1)),  //
        C({B::Lsh(1, 31)}, B::Lsh(1, 0)),  //

        C({/**/ T(0b00010001000100010000000000000000)},
          /* */ T(0b00000000000000001000100010001000)),

        C({/**/ T(0b00011000000110000000000000000000)},
          /* */ T(0b00000000000000000001100000011000)),

        C({/**/ T(0b00000100000000001111111111111111)},
          /* */ T(0b11111111111111110000000000100000)),

        C({/**/ T(0b10010101111000110000011111101010)},
          /* */ T(0b01010111111000001100011110101001)),

        // Vector tests
        C({/**/ Vec(T(0b00010001000100010000000000000000),  //
                    T(0b00011000000110000000000000000000),  //
                    T(0b00000000000000001111111111111111))},
          /* */ Vec(T(0b00000000000000001000100010001000),  //
                    T(0b00000000000000000001100000011000),  //
                    T(0b11111111111111110000000000000000))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    ReverseBits,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kReverseBits),
                     testing::ValuesIn(Concat(ReverseBitsCases<i32>(),  //
                                              ReverseBitsCases<u32>()))));

template <typename T>
std::vector<Case> RadiansCases() {
    return std::vector<Case>{
        C({T(0)}, T(0)),                         //
        C({-T(0)}, -T(0)),                       //
        C({T(40)}, T(0.69813168)).FloatComp(),   //
        C({-T(90)}, -T(1.5707964)).FloatComp(),  //
        C({T(90)}, T(1.5707964)).FloatComp(),    //
        C({T(360)}, T(6.2831855)).FloatComp(),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Radians,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kRadians),
                     testing::ValuesIn(Concat(RadiansCases<AFloat>(),  //
                                              RadiansCases<f32>()))));

template <typename T>
std::vector<Case> RadiansF16Cases() {
    return std::vector<Case>{
        C({T(0)}, T(0)),                         //
        C({-T(0)}, -T(0)),                       //
        C({T(40)}, T(0.69726562)).FloatComp(),   //
        C({-T(90)}, -T(1.5693359)).FloatComp(),  //
        C({T(90)}, T(1.5693359)).FloatComp(),    //
        C({T(360)}, T(6.2773438)).FloatComp(),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    RadiansF16,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kRadians),
                     testing::ValuesIn(RadiansF16Cases<f16>())));

template <typename T>
std::vector<Case> RoundCases() {
    std::vector<Case> cases = {
        C({T(0.0)}, T(0.0)),      //
        C({-T(0.0)}, -T(0.0)),    //
        C({T(1.5)}, T(2.0)),      //
        C({T(2.5)}, T(2.0)),      //
        C({T(2.4)}, T(2.0)),      //
        C({T(2.6)}, T(3.0)),      //
        C({T(1.49999)}, T(1.0)),  //
        C({T(1.50001)}, T(2.0)),  //
        C({-T(1.5)}, -T(2.0)),    //
        C({-T(2.5)}, -T(2.0)),    //
        C({-T(2.6)}, -T(3.0)),    //
        C({-T(2.4)}, -T(2.0)),    //

        // Vector tests
        C({Vec(T(0.0), T(1.5), T(2.5))}, Vec(T(0.0), T(2.0), T(2.0))),
    };

    return cases;
}
INSTANTIATE_TEST_SUITE_P(  //
    Round,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kRound),
                     testing::ValuesIn(Concat(RoundCases<AFloat>(),  //
                                              RoundCases<f32>(),
                                              RoundCases<f16>()))));

template <typename T>
std::vector<Case> SaturateCases() {
    return {
        C({T(0)}, T(0)),
        C({T(1)}, T(1)),
        C({T::Lowest()}, T(0)),
        C({T::Highest()}, T(1)),

        // Vector tests
        C({Vec(T(0), T(0))},                       //
          Vec(T(0), T(0))),                        //
        C({Vec(T(1), T(1))},                       //
          Vec(T(1), T(1))),                        //
        C({Vec(T::Lowest(), T(0), T::Highest())},  //
          Vec(T(0), T(0), T(1))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Saturate,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kSaturate),
                     testing::ValuesIn(Concat(SaturateCases<AFloat>(),  //
                                              SaturateCases<f32>(),
                                              SaturateCases<f16>()))));

template <typename T>
std::vector<Case> SelectCases() {
    return {
        C({Val(T{1}), Val(T{2}), Val(false)}, Val(T{1})),
        C({Val(T{1}), Val(T{2}), Val(true)}, Val(T{2})),

        C({Val(T{2}), Val(T{1}), Val(false)}, Val(T{2})),
        C({Val(T{2}), Val(T{1}), Val(true)}, Val(T{1})),

        C({Vec(T{1}, T{2}), Vec(T{3}, T{4}), Vec(false, false)}, Vec(T{1}, T{2})),
        C({Vec(T{1}, T{2}), Vec(T{3}, T{4}), Vec(false, true)}, Vec(T{1}, T{4})),
        C({Vec(T{1}, T{2}), Vec(T{3}, T{4}), Vec(true, false)}, Vec(T{3}, T{2})),
        C({Vec(T{1}, T{2}), Vec(T{3}, T{4}), Vec(true, true)}, Vec(T{3}, T{4})),

        C({Vec(T{1}, T{1}, T{2}, T{2}),     //
           Vec(T{2}, T{2}, T{1}, T{1}),     //
           Vec(false, true, false, true)},  //
          Vec(T{1}, T{2}, T{2}, T{1})),     //
    };
}
static std::vector<Case> SelectBoolCases() {
    return {
        C({Val(true), Val(false), Val(false)}, Val(true)),
        C({Val(true), Val(false), Val(true)}, Val(false)),

        C({Val(false), Val(true), Val(true)}, Val(true)),
        C({Val(false), Val(true), Val(false)}, Val(false)),

        C({Vec(true, true, false, false),   //
           Vec(false, false, true, true),   //
           Vec(false, true, true, false)},  //
          Vec(true, false, true, false)),   //
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Select,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kSelect),
                     testing::ValuesIn(Concat(SelectCases<AInt>(),  //
                                              SelectCases<i32>(),
                                              SelectCases<u32>(),
                                              SelectCases<AFloat>(),
                                              SelectCases<f32>(),
                                              SelectCases<f16>(),
                                              SelectBoolCases()))));

template <typename T>
std::vector<Case> SignCases() {
    return {
        C({-T(1)}, -T(1)),
        C({-T(0.5)}, -T(1)),
        C({T(0)}, T(0)),
        C({-T(0)}, T(0)),
        C({T(0.5)}, T(1)),
        C({T(1)}, T(1)),

        C({T::Highest()}, T(1.0)),
        C({T::Lowest()}, -T(1.0)),

        // Vector tests
        C({Vec(-T(0.5), T(0), T(0.5))}, Vec(-T(1.0), T(0.0), T(1.0))),
        C({Vec(T::Highest(), T::Lowest())}, Vec(T(1.0), -T(1.0))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Sign,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kSign),
                     testing::ValuesIn(Concat(SignCases<AFloat>(),  //
                                              SignCases<f32>(),
                                              SignCases<f16>()))));

template <typename T>
std::vector<Case> SinCases() {
    std::vector<Case> cases = {
        C({-T(0)}, -T(0)),
        C({T(0)}, T(0)),
        C({T(0.75)}, T(0.68163876)).FloatComp(),
        C({-T(0.75)}, -T(0.68163876)).FloatComp(),

        // Vector test
        C({Vec(T(0), -T(0), T(0.75))}, Vec(T(0), -T(0), T(0.68163876))).FloatComp(),
    };

    return cases;
}
INSTANTIATE_TEST_SUITE_P(  //
    Sin,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kSin),
                     testing::ValuesIn(Concat(SinCases<AFloat>(),  //
                                              SinCases<f32>(),
                                              SinCases<f16>()))));

template <typename T>
std::vector<Case> SinhCases() {
    auto error_msg = [](auto a) {
        return "12:34 error: " + OverflowErrorMessage(a, FriendlyName<decltype(a)>());
    };
    std::vector<Case> cases = {
        C({T(0)}, T(0)),
        C({-T(0)}, -T(0)),
        C({T(1)}, T(1.1752012)).FloatComp(),
        C({T(-1)}, -T(1.1752012)).FloatComp(),

        // Vector tests
        C({Vec(T(0), -T(0), T(1))}, Vec(T(0), -T(0), T(1.1752012))).FloatComp(),

        E({T(10000)}, error_msg(T::Inf())),
    };
    return cases;
}
INSTANTIATE_TEST_SUITE_P(  //
    Sinh,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kSinh),
                     testing::ValuesIn(Concat(SinhCases<AFloat>(),  //
                                              SinhCases<f32>(),
                                              SinhCases<f16>()))));

template <typename T>
std::vector<Case> SmoothstepCases() {
    auto error_msg = [](auto a, const char* op, auto b) {
        return "12:34 error: " + OverflowErrorMessage(a, op, b) + R"(
12:34 note: when calculating smoothstep)";
    };
    return {
        // t == 0
        C({T(4), T(6), T(2)}, T(0)),
        // t == 1
        C({T(4), T(6), T(8)}, T(1)),
        // t == .5
        C({T(4), T(6), T(5)}, T(.5)),

        // Vector tests
        C({Vec(T(4), T(4)), Vec(T(6), T(6)), Vec(T(2), T(8))}, Vec(T(0), T(1))),

        // `x - low` underflows
        E({T::Highest(), T(1), T::Lowest()}, error_msg(T::Lowest(), "-", T::Highest())),
        // `high - low` underflows
        E({T::Highest(), T::Lowest(), T(0)}, error_msg(T::Lowest(), "-", T::Highest())),
        // Divide by zero on `(x - low) / (high - low)`
        E({T(0), T(0), T(0)}, error_msg(T(0), "/", T(0))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Smoothstep,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kSmoothstep),
                     testing::ValuesIn(Concat(SmoothstepCases<AFloat>(),  //
                                              SmoothstepCases<f32>(),
                                              SmoothstepCases<f16>()))));

template <typename T>
std::vector<Case> StepCases() {
    return {
        C({T(0), T(0)}, T(1.0)),
        C({T(0), T(0.5)}, T(1.0)),
        C({T(0.5), T(0)}, T(0.0)),
        C({T(1), T(0.5)}, T(0.0)),
        C({T(0.5), T(1)}, T(1.0)),
        C({T(1.5), T(1)}, T(0.0)),
        C({T(1), T(1.5)}, T(1.0)),
        C({T(-1), T(1)}, T(1.0)),
        C({T(-1), T(1)}, T(1.0)),
        C({T(1), T(-1)}, T(0.0)),
        C({T(-1), T(-1.5)}, T(0.0)),
        C({T(-1.5), T(-1)}, T(1.0)),
        C({T::Highest(), T::Lowest()}, T(0.0)),
        C({T::Lowest(), T::Highest()}, T(1.0)),

        // Vector tests
        C({Vec(T(0), T(0)), Vec(T(0), T(0))}, Vec(T(1.0), T(1.0))),
        C({Vec(T(-1), T(1)), Vec(T(0), T(0))}, Vec(T(1.0), T(0.0))),
        C({Vec(T::Highest(), T::Lowest()), Vec(T::Lowest(), T::Highest())}, Vec(T(0.0), T(1.0))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Step,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kStep),
                     testing::ValuesIn(Concat(StepCases<AFloat>(),  //
                                              StepCases<f32>(),
                                              StepCases<f16>()))));

template <typename T>
std::vector<Case> SqrtCases() {
    std::vector<Case> cases = {
        C({-T(0)}, -T(0)),  //
        C({T(0)}, T(0)),    //
        C({T(25)}, T(5)),

        // Vector tests
        C({Vec(T(25), T(100))}, Vec(T(5), T(10))),

        E({-T(25)}, "12:34 error: sqrt must be called with a value >= 0"),
    };
    return cases;
}
INSTANTIATE_TEST_SUITE_P(  //
    Sqrt,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kSqrt),
                     testing::ValuesIn(Concat(SqrtCases<AFloat>(),  //
                                              SqrtCases<f32>(),
                                              SqrtCases<f16>()))));

template <typename T>
std::vector<Case> TanCases() {
    std::vector<Case> cases = {
        C({-T(0)}, -T(0)),
        C({T(0)}, T(0)),
        C({T(.75)}, T(0.9315964599)).FloatComp(),

        // Vector test
        C({Vec(T(0), -T(0), T(.75))}, Vec(T(0), -T(0), T(0.9315964599))).FloatComp(),
    };

    return cases;
}
INSTANTIATE_TEST_SUITE_P(  //
    Tan,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kTan),
                     testing::ValuesIn(Concat(TanCases<AFloat>(),  //
                                              TanCases<f32>(),
                                              TanCases<f16>()))));

template <typename T>
std::vector<Case> TanhCases() {
    std::vector<Case> cases = {
        C({T(0)}, T(0)),
        C({-T(0)}, -T(0)),
        C({T(1)}, T(0.761594156)).FloatComp(),
        C({T(-1)}, -T(0.761594156)).FloatComp(),

        // Vector tests
        C({Vec(T(0), -T(0), T(1))}, Vec(T(0), -T(0), T(0.761594156))).FloatComp(),
    };

    return cases;
}
INSTANTIATE_TEST_SUITE_P(  //
    Tanh,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kTanh),
                     testing::ValuesIn(Concat(TanhCases<AFloat>(),  //
                                              TanhCases<f32>(),
                                              TanhCases<f16>()))));

template <typename T>
std::vector<Case> TruncCases() {
    std::vector<Case> cases = {C({T(0)}, T(0)),    //
                               C({-T(0)}, -T(0)),  //
                               C({T(1.5)}, T(1)),  //
                               C({-T(1.5)}, -T(1)),

                               // Vector tests
                               C({Vec(T(0.0), T(1.5), -T(2.2))}, Vec(T(0), T(1), -T(2)))};

    return cases;
}
INSTANTIATE_TEST_SUITE_P(  //
    Trunc,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kTrunc),
                     testing::ValuesIn(Concat(TruncCases<AFloat>(),  //
                                              TruncCases<f32>(),
                                              TruncCases<f16>()))));

std::vector<Case> Unpack4x8snormCases() {
    return {
        C({Val(u32(0x0000'0000))}, Vec(f32(0), f32(0), f32(0), f32(0))),
        C({Val(u32(0x8100'0000))}, Vec(f32(0), f32(0), f32(0), f32(-1))),
        C({Val(u32(0x7f00'0000))}, Vec(f32(0), f32(0), f32(0), f32(1))),
        C({Val(u32(0x0081'0000))}, Vec(f32(0), f32(0), f32(-1), f32(0))),
        C({Val(u32(0x0000'7f00))}, Vec(f32(0), f32(1), f32(0), f32(0))),
        C({Val(u32(0x0000'0081))}, Vec(f32(-1), f32(0), f32(0), f32(0))),
        C({Val(u32(0x817f'817f))}, Vec(f32(1), f32(-1), f32(1), f32(-1))),
        C({Val(u32(0x816d'937f))},
          Vec(f32(1), f32(-0.8582677165354), f32(0.8582677165354), f32(-1))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Unpack4x8snorm,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kUnpack4X8Snorm),
                     testing::ValuesIn(Unpack4x8snormCases())));

std::vector<Case> Unpack4x8unormCases() {
    return {
        C({Val(u32(0x0000'0000))}, Vec(f32(0), f32(0), f32(0), f32(0))),
        C({Val(u32(0xff00'0000))}, Vec(f32(0), f32(0), f32(0), f32(1))),
        C({Val(u32(0x00ff'0000))}, Vec(f32(0), f32(0), f32(1), f32(0))),
        C({Val(u32(0x0000'ff00))}, Vec(f32(0), f32(1), f32(0), f32(0))),
        C({Val(u32(0x0000'00ff))}, Vec(f32(1), f32(0), f32(0), f32(0))),
        C({Val(u32(0x00ff'00ff))}, Vec(f32(1), f32(0), f32(1), f32(0))),
        C({Val(u32(0x0066'00ff))}, Vec(f32(1), f32(0), f32(0.4), f32(0))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Unpack4x8unorm,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kUnpack4X8Unorm),
                     testing::ValuesIn(Unpack4x8unormCases())));

std::vector<Case> Unpack2x16floatCases() {
    return {
        C({Val(u32(0x7bff'fbff))}, Vec(f32(f16::Lowest()), f32(f16::Highest()))),
        C({Val(u32(0xbc00'3c00))}, Vec(f32(1), f32(-1))),
        C({Val(u32(0x0000'0000))}, Vec(f32(0), f32(0))),
        C({Val(u32(0xc940'4900))}, Vec(f32(10), f32(-10.5))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Unpack2x16float,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kUnpack2X16Float),
                     testing::ValuesIn(Unpack2x16floatCases())));

std::vector<Case> Unpack2x16snormCases() {
    return {
        C({Val(u32(0x0000'0000))}, Vec(f32(0), f32(0))),
        C({Val(u32(0x8001'0000))}, Vec(f32(0), f32(-1))),
        C({Val(u32(0x7fff'0000))}, Vec(f32(0), f32(1))),
        C({Val(u32(0x0000'8001))}, Vec(f32(-1), f32(0))),
        C({Val(u32(0x0000'7fff))}, Vec(f32(1), f32(0))),
        C({Val(u32(0x8001'7fff))}, Vec(f32(1), f32(-1))),
        C({Val(u32(0x8001'7fff))}, Vec(f32(1), f32(-1))),
        C({Val(u32(0x4000'999a))}, Vec(f32(-0.80001220740379), f32(0.500015259254737))).FloatComp(),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Unpack2x16snorm,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kUnpack2X16Snorm),
                     testing::ValuesIn(Unpack2x16snormCases())));

std::vector<Case> Unpack2x16unormCases() {
    return {
        C({Val(u32(0xffff'0000))}, Vec(f32(0), f32(1))),
        C({Val(u32(0x0000'ffff))}, Vec(f32(1), f32(0))),
        C({Val(u32(0x0000'6666))}, Vec(f32(0.4), f32(0))),
        C({Val(u32(0x0000'ffff))}, Vec(f32(1), f32(0))),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    Unpack2x16unorm,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kUnpack2X16Unorm),
                     testing::ValuesIn(Unpack2x16unormCases())));

std::vector<Case> QuantizeToF16Cases() {
    return {
        C({0_f}, 0_f),    //
        C({-0_f}, -0_f),  //
        C({1_f}, 1_f),    //
        C({-1_f}, -1_f),  //

        //   0.00006106496 quantized to 0.000061035156 = 0x1p-14
        C({0.00006106496_f}, 0.000061035156_f),    //
        C({-0.00006106496_f}, -0.000061035156_f),  //

        //   1.0004883 quantized to 1.0 = 0x1p0
        C({1.0004883_f}, 1.0_f),    //
        C({-1.0004883_f}, -1.0_f),  //

        //   8196.0 quantized to 8192.0 = 0x1p13
        C({8196_f}, 8192_f),    //
        C({-8196_f}, -8192_f),  //

        // Value in subnormal f16 range
        C({0x0.034p-14_f}, 0x0.034p-14_f),    //
        C({-0x0.034p-14_f}, -0x0.034p-14_f),  //
        C({0x0.068p-14_f}, 0x0.068p-14_f),    //
        C({-0x0.068p-14_f}, -0x0.068p-14_f),  //

        //   0x0.06b7p-14 quantized to 0x0.068p-14
        C({0x0.06b7p-14_f}, 0x0.068p-14_f),    //
        C({-0x0.06b7p-14_f}, -0x0.068p-14_f),  //

        // Vector tests
        C({Vec(0_f, -0_f)}, Vec(0_f, -0_f)),  //
        C({Vec(1_f, -1_f)}, Vec(1_f, -1_f)),  //

        C({Vec(0.00006106496_f, -0.00006106496_f, 1.0004883_f, -1.0004883_f)},
          Vec(0.000061035156_f, -0.000061035156_f, 1.0_f, -1.0_f)),

        C({Vec(8196_f, 8192_f, 0x0.034p-14_f)}, Vec(8192_f, 8192_f, 0x0.034p-14_f)),

        C({Vec(0x0.034p-14_f, -0x0.034p-14_f, 0x0.068p-14_f, -0x0.068p-14_f)},
          Vec(0x0.034p-14_f, -0x0.034p-14_f, 0x0.068p-14_f, -0x0.068p-14_f)),

        // Value out of f16 range
        E({65504.003_f}, "12:34 error: value 65504.00390625 cannot be represented as 'f16'"),
        E({-65504.003_f}, "12:34 error: value -65504.00390625 cannot be represented as 'f16'"),
        E({0x1.234p56_f}, "12:34 error: value 81979586966978560 cannot be represented as 'f16'"),
        E({0x4.321p65_f},
          "12:34 error: value 1.5478871919272394752e+20 cannot be represented as 'f16'"),
        E({Vec(65504.003_f, 0_f)},
          "12:34 error: value 65504.00390625 cannot be represented as 'f16'"),
        E({Vec(0_f, -0x4.321p65_f)},
          "12:34 error: value -1.5478871919272394752e+20 cannot be represented as 'f16'"),
    };
}
INSTANTIATE_TEST_SUITE_P(  //
    QuantizeToF16,
    ResolverConstEvalBuiltinTest,
    testing::Combine(testing::Values(sem::BuiltinType::kQuantizeToF16),
                     testing::ValuesIn(QuantizeToF16Cases())));

}  // namespace
}  // namespace tint::resolver
