[spirv-writer] Add binary greater than equal comparison.
This CL adds generation for the binary greater than or equal comparison. Bug: tint:5 Change-Id: I5c81b7d142d29f388800d8b576ec69dc260b243e Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19407 Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
parent
d7e2add6f3
commit
f558809b54
|
@ -587,6 +587,14 @@ uint32_t Builder::GenerateBinaryExpression(ast::BinaryExpression* expr) {
|
|||
} else {
|
||||
op = spv::Op::OpSGreaterThan;
|
||||
}
|
||||
} else if (expr->IsGreaterThanEqual()) {
|
||||
if (lhs_is_float_or_vec) {
|
||||
op = spv::Op::OpFOrdGreaterThanEqual;
|
||||
} else if (lhs_is_unsigned) {
|
||||
op = spv::Op::OpUGreaterThanEqual;
|
||||
} else {
|
||||
op = spv::Op::OpSGreaterThanEqual;
|
||||
}
|
||||
} else if (expr->IsLessThan()) {
|
||||
if (lhs_is_float_or_vec) {
|
||||
op = spv::Op::OpFOrdLessThan;
|
||||
|
|
|
@ -280,12 +280,13 @@ TEST_P(BinaryCompareUnsignedIntegerTest, Vector) {
|
|||
INSTANTIATE_TEST_SUITE_P(
|
||||
BuilderTest,
|
||||
BinaryCompareUnsignedIntegerTest,
|
||||
testing::Values(BinaryData{ast::BinaryOp::kEqual, "OpIEqual"},
|
||||
BinaryData{ast::BinaryOp::kGreaterThan, "OpUGreaterThan"},
|
||||
BinaryData{ast::BinaryOp::kLessThan, "OpULessThan"},
|
||||
BinaryData{ast::BinaryOp::kLessThanEqual,
|
||||
"OpULessThanEqual"},
|
||||
BinaryData{ast::BinaryOp::kNotEqual, "OpINotEqual"}));
|
||||
testing::Values(
|
||||
BinaryData{ast::BinaryOp::kEqual, "OpIEqual"},
|
||||
BinaryData{ast::BinaryOp::kGreaterThan, "OpUGreaterThan"},
|
||||
BinaryData{ast::BinaryOp::kGreaterThanEqual, "OpUGreaterThanEqual"},
|
||||
BinaryData{ast::BinaryOp::kLessThan, "OpULessThan"},
|
||||
BinaryData{ast::BinaryOp::kLessThanEqual, "OpULessThanEqual"},
|
||||
BinaryData{ast::BinaryOp::kNotEqual, "OpINotEqual"}));
|
||||
|
||||
using BinaryCompareSignedIntegerTest = testing::TestWithParam<BinaryData>;
|
||||
TEST_P(BinaryCompareSignedIntegerTest, Scalar) {
|
||||
|
@ -366,12 +367,13 @@ TEST_P(BinaryCompareSignedIntegerTest, Vector) {
|
|||
INSTANTIATE_TEST_SUITE_P(
|
||||
BuilderTest,
|
||||
BinaryCompareSignedIntegerTest,
|
||||
testing::Values(BinaryData{ast::BinaryOp::kEqual, "OpIEqual"},
|
||||
BinaryData{ast::BinaryOp::kGreaterThan, "OpSGreaterThan"},
|
||||
BinaryData{ast::BinaryOp::kLessThan, "OpSLessThan"},
|
||||
BinaryData{ast::BinaryOp::kLessThanEqual,
|
||||
"OpSLessThanEqual"},
|
||||
BinaryData{ast::BinaryOp::kNotEqual, "OpINotEqual"}));
|
||||
testing::Values(
|
||||
BinaryData{ast::BinaryOp::kEqual, "OpIEqual"},
|
||||
BinaryData{ast::BinaryOp::kGreaterThan, "OpSGreaterThan"},
|
||||
BinaryData{ast::BinaryOp::kGreaterThanEqual, "OpSGreaterThanEqual"},
|
||||
BinaryData{ast::BinaryOp::kLessThan, "OpSLessThan"},
|
||||
BinaryData{ast::BinaryOp::kLessThanEqual, "OpSLessThanEqual"},
|
||||
BinaryData{ast::BinaryOp::kNotEqual, "OpINotEqual"}));
|
||||
|
||||
using BinaryCompareFloatTest = testing::TestWithParam<BinaryData>;
|
||||
TEST_P(BinaryCompareFloatTest, Scalar) {
|
||||
|
@ -455,6 +457,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
testing::Values(
|
||||
BinaryData{ast::BinaryOp::kEqual, "OpFOrdEqual"},
|
||||
BinaryData{ast::BinaryOp::kGreaterThan, "OpFOrdGreaterThan"},
|
||||
BinaryData{ast::BinaryOp::kGreaterThanEqual, "OpFOrdGreaterThanEqual"},
|
||||
BinaryData{ast::BinaryOp::kLessThan, "OpFOrdLessThan"},
|
||||
BinaryData{ast::BinaryOp::kLessThanEqual, "OpFOrdLessThanEqual"},
|
||||
BinaryData{ast::BinaryOp::kNotEqual, "OpFOrdNotEqual"}));
|
||||
|
|
Loading…
Reference in New Issue