[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 {
|
} else {
|
||||||
op = spv::Op::OpSGreaterThan;
|
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()) {
|
} else if (expr->IsLessThan()) {
|
||||||
if (lhs_is_float_or_vec) {
|
if (lhs_is_float_or_vec) {
|
||||||
op = spv::Op::OpFOrdLessThan;
|
op = spv::Op::OpFOrdLessThan;
|
||||||
|
|
|
@ -280,12 +280,13 @@ TEST_P(BinaryCompareUnsignedIntegerTest, Vector) {
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
BuilderTest,
|
BuilderTest,
|
||||||
BinaryCompareUnsignedIntegerTest,
|
BinaryCompareUnsignedIntegerTest,
|
||||||
testing::Values(BinaryData{ast::BinaryOp::kEqual, "OpIEqual"},
|
testing::Values(
|
||||||
BinaryData{ast::BinaryOp::kGreaterThan, "OpUGreaterThan"},
|
BinaryData{ast::BinaryOp::kEqual, "OpIEqual"},
|
||||||
BinaryData{ast::BinaryOp::kLessThan, "OpULessThan"},
|
BinaryData{ast::BinaryOp::kGreaterThan, "OpUGreaterThan"},
|
||||||
BinaryData{ast::BinaryOp::kLessThanEqual,
|
BinaryData{ast::BinaryOp::kGreaterThanEqual, "OpUGreaterThanEqual"},
|
||||||
"OpULessThanEqual"},
|
BinaryData{ast::BinaryOp::kLessThan, "OpULessThan"},
|
||||||
BinaryData{ast::BinaryOp::kNotEqual, "OpINotEqual"}));
|
BinaryData{ast::BinaryOp::kLessThanEqual, "OpULessThanEqual"},
|
||||||
|
BinaryData{ast::BinaryOp::kNotEqual, "OpINotEqual"}));
|
||||||
|
|
||||||
using BinaryCompareSignedIntegerTest = testing::TestWithParam<BinaryData>;
|
using BinaryCompareSignedIntegerTest = testing::TestWithParam<BinaryData>;
|
||||||
TEST_P(BinaryCompareSignedIntegerTest, Scalar) {
|
TEST_P(BinaryCompareSignedIntegerTest, Scalar) {
|
||||||
|
@ -366,12 +367,13 @@ TEST_P(BinaryCompareSignedIntegerTest, Vector) {
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
BuilderTest,
|
BuilderTest,
|
||||||
BinaryCompareSignedIntegerTest,
|
BinaryCompareSignedIntegerTest,
|
||||||
testing::Values(BinaryData{ast::BinaryOp::kEqual, "OpIEqual"},
|
testing::Values(
|
||||||
BinaryData{ast::BinaryOp::kGreaterThan, "OpSGreaterThan"},
|
BinaryData{ast::BinaryOp::kEqual, "OpIEqual"},
|
||||||
BinaryData{ast::BinaryOp::kLessThan, "OpSLessThan"},
|
BinaryData{ast::BinaryOp::kGreaterThan, "OpSGreaterThan"},
|
||||||
BinaryData{ast::BinaryOp::kLessThanEqual,
|
BinaryData{ast::BinaryOp::kGreaterThanEqual, "OpSGreaterThanEqual"},
|
||||||
"OpSLessThanEqual"},
|
BinaryData{ast::BinaryOp::kLessThan, "OpSLessThan"},
|
||||||
BinaryData{ast::BinaryOp::kNotEqual, "OpINotEqual"}));
|
BinaryData{ast::BinaryOp::kLessThanEqual, "OpSLessThanEqual"},
|
||||||
|
BinaryData{ast::BinaryOp::kNotEqual, "OpINotEqual"}));
|
||||||
|
|
||||||
using BinaryCompareFloatTest = testing::TestWithParam<BinaryData>;
|
using BinaryCompareFloatTest = testing::TestWithParam<BinaryData>;
|
||||||
TEST_P(BinaryCompareFloatTest, Scalar) {
|
TEST_P(BinaryCompareFloatTest, Scalar) {
|
||||||
|
@ -455,6 +457,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
testing::Values(
|
testing::Values(
|
||||||
BinaryData{ast::BinaryOp::kEqual, "OpFOrdEqual"},
|
BinaryData{ast::BinaryOp::kEqual, "OpFOrdEqual"},
|
||||||
BinaryData{ast::BinaryOp::kGreaterThan, "OpFOrdGreaterThan"},
|
BinaryData{ast::BinaryOp::kGreaterThan, "OpFOrdGreaterThan"},
|
||||||
|
BinaryData{ast::BinaryOp::kGreaterThanEqual, "OpFOrdGreaterThanEqual"},
|
||||||
BinaryData{ast::BinaryOp::kLessThan, "OpFOrdLessThan"},
|
BinaryData{ast::BinaryOp::kLessThan, "OpFOrdLessThan"},
|
||||||
BinaryData{ast::BinaryOp::kLessThanEqual, "OpFOrdLessThanEqual"},
|
BinaryData{ast::BinaryOp::kLessThanEqual, "OpFOrdLessThanEqual"},
|
||||||
BinaryData{ast::BinaryOp::kNotEqual, "OpFOrdNotEqual"}));
|
BinaryData{ast::BinaryOp::kNotEqual, "OpFOrdNotEqual"}));
|
||||||
|
|
Loading…
Reference in New Issue