[spirv-writer] Add binary greater than comparison.
This CL adds the binary greater then comparison output. Bug: tint:5 Change-Id: I86fa90b3d98f3ee81174edafb188c445b94f9d29 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19405 Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
parent
f30c212987
commit
6b9587b697
|
@ -579,6 +579,14 @@ uint32_t Builder::GenerateBinaryExpression(ast::BinaryExpression* expr) {
|
|||
op = lhs_is_float_or_vec ? spv::Op::OpFAdd : spv::Op::OpIAdd;
|
||||
} else if (expr->IsEqual()) {
|
||||
op = lhs_is_float_or_vec ? spv::Op::OpFOrdEqual : spv::Op::OpIEqual;
|
||||
} else if (expr->IsGreaterThan()) {
|
||||
if (lhs_is_float_or_vec) {
|
||||
op = spv::Op::OpFOrdGreaterThan;
|
||||
} else if (lhs_is_unsigned) {
|
||||
op = spv::Op::OpUGreaterThan;
|
||||
} else {
|
||||
op = spv::Op::OpSGreaterThan;
|
||||
}
|
||||
} else if (expr->IsLessThan()) {
|
||||
if (lhs_is_float_or_vec) {
|
||||
op = spv::Op::OpFOrdLessThan;
|
||||
|
|
|
@ -281,6 +281,7 @@ 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::kNotEqual, "OpINotEqual"}));
|
||||
|
||||
|
@ -364,6 +365,7 @@ 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::kNotEqual, "OpINotEqual"}));
|
||||
|
||||
|
@ -447,6 +449,8 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
BuilderTest,
|
||||
BinaryCompareFloatTest,
|
||||
testing::Values(BinaryData{ast::BinaryOp::kEqual, "OpFOrdEqual"},
|
||||
BinaryData{ast::BinaryOp::kGreaterThan,
|
||||
"OpFOrdGreaterThan"},
|
||||
BinaryData{ast::BinaryOp::kLessThan, "OpFOrdLessThan"},
|
||||
BinaryData{ast::BinaryOp::kNotEqual, "OpFOrdNotEqual"}));
|
||||
|
||||
|
|
Loading…
Reference in New Issue