mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-05 06:03:34 +00:00
[spirv-writer] Add subtracting generation.
This CL adds generation of the OpFSub and OpISub SPIR-V commands from the subtraction binary expression. Bug: tint:5 Change-Id: Ia25a855a972057a4cac70d538946e176e0a0e5c3 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19505 Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
266a32954e
commit
35c0d4bbe1
@ -619,6 +619,8 @@ uint32_t Builder::GenerateBinaryExpression(ast::BinaryExpression* expr) {
|
||||
op = lhs_is_float_or_vec ? spv::Op::OpFOrdNotEqual : spv::Op::OpINotEqual;
|
||||
} else if (expr->IsOr()) {
|
||||
op = spv::Op::OpBitwiseOr;
|
||||
} else if (expr->IsSubtract()) {
|
||||
op = lhs_is_float_or_vec ? spv::Op::OpFSub : spv::Op::OpISub;
|
||||
} else if (expr->IsXor()) {
|
||||
op = spv::Op::OpBitwiseXor;
|
||||
} else {
|
||||
|
@ -124,6 +124,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
testing::Values(BinaryData{ast::BinaryOp::kAdd, "OpIAdd"},
|
||||
BinaryData{ast::BinaryOp::kAnd, "OpBitwiseAnd"},
|
||||
BinaryData{ast::BinaryOp::kOr, "OpBitwiseOr"},
|
||||
BinaryData{ast::BinaryOp::kSubtract, "OpISub"},
|
||||
BinaryData{ast::BinaryOp::kXor, "OpBitwiseXor"}));
|
||||
|
||||
using BinaryArithFloatTest = testing::TestWithParam<BinaryData>;
|
||||
@ -199,10 +200,11 @@ TEST_P(BinaryArithFloatTest, Vector) {
|
||||
EXPECT_EQ(DumpInstructions(b.functions()[0].instructions()),
|
||||
"%5 = " + param.name + " %1 %4 %4\n");
|
||||
}
|
||||
INSTANTIATE_TEST_SUITE_P(BuilderTest,
|
||||
BinaryArithFloatTest,
|
||||
testing::Values(BinaryData{ast::BinaryOp::kAdd,
|
||||
"OpFAdd"}));
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
BuilderTest,
|
||||
BinaryArithFloatTest,
|
||||
testing::Values(BinaryData{ast::BinaryOp::kAdd, "OpFAdd"},
|
||||
BinaryData{ast::BinaryOp::kSubtract, "OpFSub"}));
|
||||
|
||||
using BinaryCompareUnsignedIntegerTest = testing::TestWithParam<BinaryData>;
|
||||
TEST_P(BinaryCompareUnsignedIntegerTest, Scalar) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user