Use ConcatIntoIf in const-eval builtin tests.

This CL updates atan2 and atan to use the ConcatIntoIf helper
instead of doing the case concatention.

Bug: tint:1581
Change-Id: I4ea3153aefcab18db88ab81dd499b9f9e37e7906
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106846
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
dan sinclair 2022-10-25 14:47:31 +00:00 committed by Dawn LUCI CQ
parent 30bc8d76e7
commit 0423c3ccd0
2 changed files with 4875 additions and 4879 deletions

View File

@ -169,8 +169,8 @@ std::vector<Case> Atan2Cases() {
C({Vec(T(1.0), T(1.0)), Vec(T(0.0), -T(0.0))}, Vec(kPiOver2<T>, kPiOver2<T>)).FloatComp(),
};
if constexpr (!finite_only) {
std::vector<Case> non_finite_cases = {
ConcatIntoIf<!finite_only>( //
cases, std::vector<Case>{
// If y is +/-INF and x is finite, +/-PI/2 is returned
C({T::Inf(), T(0.0)}, kPiOver2<T>).PosOrNeg().FloatComp(),
C({-T::Inf(), T(0.0)}, kPiOver2<T>).PosOrNeg().FloatComp(),
@ -206,9 +206,7 @@ std::vector<Case> Atan2Cases() {
Vec(kPiOver2<T>, kPiOver2<T>, k3PiOver4<T>, k3PiOver4<T>))
.PosOrNeg()
.FloatComp(),
};
cases = Concat(cases, non_finite_cases);
}
});
return cases;
}
@ -233,8 +231,8 @@ std::vector<Case> AtanCases() {
C({Vec(T(0.0), T(1.0), -T(1.0))}, Vec(T(0.0), kPiOver4<T>, -kPiOver4<T>)).FloatComp(),
};
if constexpr (!finite_only) {
std::vector<Case> non_finite_cases = {
ConcatIntoIf<!finite_only>( //
cases, std::vector<Case>{
// If i is +/-INF, +/-PI/2 is returned
C({T::Inf()}, kPiOver2<T>).PosOrNeg().FloatComp(),
C({-T::Inf()}, -kPiOver2<T>).FloatComp(),
@ -246,9 +244,7 @@ std::vector<Case> AtanCases() {
C({Vec(T::Inf(), -T::Inf(), T::Inf(), -T::Inf())}, //
Vec(kPiOver2<T>, -kPiOver2<T>, kPiOver2<T>, -kPiOver2<T>))
.FloatComp(),
};
cases = Concat(cases, non_finite_cases);
}
});
return cases;
}

File diff suppressed because it is too large Load Diff